datetime
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDateTime Natural Language Parser
日期时间自然语言解析器
Parse natural language date and time expressions using GNU command (native Linux utility).
date使用GNU 命令(Linux原生工具)解析自然语言日期和时间表达式。
dateIMPORTANT: For Claude Code
重要提示:针对Claude Code
DO NOT invoke slash commands (, , ) - those are for users only.
/datetime:parse/datetime:now/datetime:calcInstead, use the command directly via the Bash tool:
datebash
undefined请勿使用斜杠命令(, , )——这些仅面向用户使用。
/datetime:parse/datetime:now/datetime:calc请改为通过Bash工具直接使用命令:
datebash
undefinedGet 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)
undefinedundefinedWhen 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 command:
date -dGet 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 command doesn't understand "in" keyword. When user says "in 3 days", use instead.
date"3 days"通过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)'注意:命令无法识别“in”关键词。当用户说“in 3 days”时,请使用替代。
date"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 fails with an invalid expression:
date -d- Recognize the failure: If the command returns an error, inform the user the expression couldn't be parsed
- Try alternative approaches: Check for:
references/reference.md- Date arithmetic examples (if user wants relative calculations)
- Complex expression syntax (if user wants compound dates)
- Unix timestamp calculations (if user wants day differences)
- Fallback to current date: If no alternative works:
bash
date '+%Y-%m-%d %H:%M:%S (%A)'
Example error handling:
bash
undefined如果因表达式无效执行失败:
date -d- 识别失败:若命令返回错误,告知用户该表达式无法解析
- 尝试替代方法:查看获取:
references/reference.md- 日期运算示例(若用户需要相对计算)
- 复杂表达式语法(若用户需要复合日期)
- Unix时间戳计算(若用户需要天数差异)
- 回退到当前日期:若无替代方案可行:
bash
date '+%Y-%m-%d %H:%M:%S (%A)'
错误处理示例:
bash
undefinedTry 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获取高级模式
undefinedundefinedAdvanced Usage
高级用法
For relative calculations, week numbers, and complex date arithmetic, see .
references/reference.md有关相对计算、周数和复杂日期运算,请查看。
references/reference.md