← 返回
未分类

Datetime Tool

Comprehensive date and time manipulation toolkit supporting multiple formats, timezone conversions, calendar calculations, natural language parsing, and date...
全面的日期时间操作工具包,支持多种格式、时区转换、日历计算、自然语言解析以及日期...
dinghaibin
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 377
下载
💾 0
安装
1
版本
#latest

概述

DateTime Tool — Advanced Date/Time Operations

Full-featured datetime manipulation toolkit for format conversion, timezone handling, date arithmetic, and calendar calculations across ISO 8601, RFC 2822, Unix timestamps, and natural language inputs.

Quick Start

# Current time in UTC
datetime-tool --now

# Parse and reformat
datetime-tool --parse "2026-01-15 14:30:00" --format "ISO"

# Timezone conversion
datetime-tool --convert "14:00 UTC" --to "Asia/Shanghai"

Usage

datetime-tool [COMMAND] [INPUT] [OPTIONS]

Commands:
  --now              Show current date/time
  --parse INPUT      Parse date from string
  --convert INPUT    Convert between timezones
  --diff START END   Calculate interval between two dates
  --add INPUT N      Add time units to a date
  --sub INPUT N      Subtract time units from a date
  --calendar YEAR    Show calendar for a year/month

Options:
  --format FMT       Output format: ISO, RFC2822, Unix, or custom format string
  --from TZ          Source timezone (default: local)
  --to TZ            Target timezone
  --units            Output units for diff: seconds, minutes, hours, days
  --json             Output as structured JSON

Examples

# Get current time in multiple formats
datetime-tool --now --format ISO
datetime-tool --now --format "January 2, 2006 at 3:04 PM"

# Parse and reformat
datetime-tool --parse "2026-01-15" --format "January 15, 2026"

# Convert between timezones
datetime-tool --convert "14:00 UTC" --to "Asia/Shanghai"
datetime-tool --convert "2026-01-15 09:00" --from "America/New_York" --to "Europe/London"

# Calculate date differences
datetime-tool --diff "2026-01-01" "2026-12-31" --units days

# Add/subtract time
datetime-tool --add "2026-01-01" --days 45
datetime-tool --sub "2026-03-01" --months 2

# Calendar view
datetime-tool --calendar 2026
datetime-tool --calendar 2026-03

# Machine-readable output
datetime-tool --parse "next Friday" --json

Features

  • Parse from natural language: "next Friday", "last day of month", "+2 weeks"
  • Timezone conversion: Any IANA timezone (UTC, local, Asia/Shanghai, etc.)
  • Date arithmetic: Add/subtract days, weeks, months, years
  • Interval calculation: Precise duration between any two dates
  • Multiple output formats: ISO 8601, RFC 2822, Unix timestamp, custom templates
  • Calendar display: Month or year view with week numbers
  • JSON output: Structured for pipeline consumption
  • ISO week numbers & day-of-year: For scheduling and accounting

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-21 13:54 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Automation Workflow

dinghaibin
创建并管理自动化工作流,以处理重复性任务。适用于需要安排周期性数据同步、链式API调用、设置触发动作等场景。
★ 0 📥 360

Schedule Task

dinghaibin
在 Linux/Unix 系统上调度和运行周期性任务。适用于设置 cron 作业、定时备份、周期性数据同步、自动报告等场景。
★ 0 📥 393

Xxd Tool

dinghaibin
创建二进制文件的十六进制转储,将转储恢复为二进制,并进行位级分析与修补。适用于逆向工程、二进制分析等关键任务。
★ 0 📥 354