datetime

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DateTime Natural Language Parser

日期时间自然语言解析器

Parse natural language date and time expressions using GNU
date
command (native Linux utility).
使用GNU
date
命令(Linux原生工具)解析自然语言日期和时间表达式。

IMPORTANT: For Claude Code

重要提示:针对Claude Code

DO NOT invoke slash commands (
/datetime:parse
,
/datetime:now
,
/datetime:calc
) - those are for users only.
Instead, use the
date
command directly via the Bash tool:
bash
undefined
请勿使用斜杠命令
/datetime:parse
,
/datetime:now
,
/datetime:calc
)——这些仅面向用户使用。
请改为通过Bash工具直接使用
date
命令:
bash
undefined

Get current date/time

获取当前日期/时间

date '+%Y-%m-%d %H:%M:%S (%A)'
date '+%Y-%m-%d %H:%M:%S (%A)'

Parse natural language

解析自然语言

date -d "tomorrow" '+%Y-%m-%d %H:%M:%S (%A)' date -d "next monday at 9am" '+%Y-%m-%d %H:%M:%S (%A)' date -d "3 days" '+%Y-%m-%d %H:%M:%S (%A)'

This skill provides the command patterns and when to use them. The slash commands are for users to invoke manually.
date -d "tomorrow" '+%Y-%m-%d %H:%M:%S (%A)' date -d "next monday at 9am" '+%Y-%m-%d %H:%M:%S (%A)' date -d "3 days" '+%Y-%m-%d %H:%M:%S (%A)'

本技能提供命令模式及使用场景。斜杠命令供用户手动调用。

Quick Example

快速示例

bash
date -d "next Friday" '+%Y-%m-%d %H:%M:%S (%A)'
bash
date -d "next Friday" '+%Y-%m-%d %H:%M:%S (%A)'

2026-02-06 00:00:00 (Friday)

2026-02-06 00:00:00 (Friday)

undefined
undefined

When to Use This Skill

使用场景

Automatically invoke when:
  • User mentions temporal expressions: "tomorrow", "next week", "in 3 days"
  • Need to verify current date/time
  • User references deadlines or time-sensitive tasks
  • <env> context shows incorrect dates
在以下场景自动调用:
  • 用户提及时间表达式:“明天”、“下周”、“3天后”
  • 需要验证当前日期/时间
  • 用户提及截止日期或时间敏感任务
  • <env>上下文显示日期不正确

How to Use

使用方法

Use the Bash tool with
date -d
command:
Get current date/time:
bash
date '+%Y-%m-%d %H:%M:%S (%A)'
Parse natural language:
bash
date -d "tomorrow" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "next wednesday" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "3 days" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "next monday 9am" '+%Y-%m-%d %H:%M:%S (%A)'
Important: The
date
command doesn't understand "in" keyword. When user says "in 3 days", use
"3 days"
instead.
通过Bash工具使用
date -d
命令:
获取当前日期/时间:
bash
date '+%Y-%m-%d %H:%M:%S (%A)'
解析自然语言:
bash
date -d "tomorrow" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "next wednesday" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "3 days" '+%Y-%m-%d %H:%M:%S (%A)'
date -d "next monday 9am" '+%Y-%m-%d %H:%M:%S (%A)'
注意
date
命令无法识别“in”关键词。当用户说“in 3 days”时,请使用
"3 days"
替代。

Output Format

输出格式

Returns single line:
YYYY-MM-DD HH:MM:SS (DayName)
Example:
2024-10-29 14:23:45 (Tuesday)
返回单行内容:
YYYY-MM-DD HH:MM:SS (DayName)
示例:
2024-10-29 14:23:45 (Tuesday)

Supported Expressions

支持的表达式

  • Relative: "today", "tomorrow", "yesterday"
  • Named days: "next monday", "this wednesday", "last friday"
  • Offsets: "3 days", "2 weeks", "5 months ago"
  • Complex: "tomorrow 3pm", "next monday at 9am"
  • Past: "3 days ago", "last week"
  • 相对时间:“today”、“tomorrow”、“yesterday”
  • 指定日期:“next monday”、“this wednesday”、“last friday”
  • 偏移量:“3 days”、“2 weeks”、“5 months ago”
  • 复合表达式:“tomorrow 3pm”、“next monday at 9am”
  • 过去时间:“3 days ago”、“last week”

Error Handling

错误处理

If
date -d
fails with an invalid expression:
  1. Recognize the failure: If the command returns an error, inform the user the expression couldn't be parsed
  2. Try alternative approaches: Check
    references/reference.md
    for:
    • Date arithmetic examples (if user wants relative calculations)
    • Complex expression syntax (if user wants compound dates)
    • Unix timestamp calculations (if user wants day differences)
  3. Fallback to current date: If no alternative works:
    bash
    date '+%Y-%m-%d %H:%M:%S (%A)'
Example error handling:
bash
undefined
如果
date -d
因表达式无效执行失败:
  1. 识别失败:若命令返回错误,告知用户该表达式无法解析
  2. 尝试替代方法:查看
    references/reference.md
    获取:
    • 日期运算示例(若用户需要相对计算)
    • 复杂表达式语法(若用户需要复合日期)
    • Unix时间戳计算(若用户需要天数差异)
  3. 回退到当前日期:若无替代方案可行:
    bash
    date '+%Y-%m-%d %H:%M:%S (%A)'
错误处理示例:
bash
undefined

Try parsing

尝试解析

date -d "user expression" '+%Y-%m-%d %H:%M:%S (%A)' 2>&1
date -d "user expression" '+%Y-%m-%d %H:%M:%S (%A)' 2>&1

If error message appears, tell user and suggest checking references/reference.md for advanced patterns

若出现错误信息,告知用户并建议查看references/reference.md获取高级模式

undefined
undefined

Advanced Usage

高级用法

For relative calculations, week numbers, and complex date arithmetic, see
references/reference.md
.
有关相对计算、周数和复杂日期运算,请查看
references/reference.md