timestamp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTimestamp Skill
Timestamp 工具
Convert between various timestamp formats.
在多种时间戳格式之间进行转换。
When to Use
适用场景
✅ USE this skill when:
- "Convert this timestamp to readable date"
- "What time is 1704067200?"
- "Get current timestamp"
- "Parse this date string"
- "Calculate time difference"
✅ 使用本工具的场景:
- "将此时间戳转换为可读日期"
- "1704067200对应的时间是什么?"
- "获取当前时间戳"
- "解析此日期字符串"
- "计算时间差"
When NOT to Use
不适用场景
❌ DON'T use this skill when:
- Scheduling tasks → use cron/system scheduler
- Time zone conversions → use timezone-aware libraries
- Calendar operations → use calendar tools
❌ 请勿使用本工具的场景:
- 任务调度 → 使用cron/系统调度器
- 时区转换 → 使用支持时区的库
- 日历操作 → 使用日历工具
Commands
命令说明
Current Time
获取当前时间
bash
{baseDir}/timestamp.sh now
{baseDir}/timestamp.sh now --format iso
{baseDir}/timestamp.sh now --format unix
{baseDir}/timestamp.sh now --utcbash
{baseDir}/timestamp.sh now
{baseDir}/timestamp.sh now --format iso
{baseDir}/timestamp.sh now --format unix
{baseDir}/timestamp.sh now --utcConvert Timestamp
转换时间戳
bash
{baseDir}/timestamp.sh convert 1704067200
{baseDir}/timestamp.sh convert "2024-01-01T00:00:00Z"
{baseDir}/timestamp.sh convert "January 1, 2024"
{baseDir}/timestamp.sh convert 1704067200 --format isobash
{baseDir}/timestamp.sh convert 1704067200
{baseDir}/timestamp.sh convert "2024-01-01T00:00:00Z"
{baseDir}/timestamp.sh convert "January 1, 2024"
{baseDir}/timestamp.sh convert 1704067200 --format isoRelative Time
相对时间计算
bash
{baseDir}/timestamp.sh relative "2 hours ago"
{baseDir}/timestamp.sh relative "tomorrow"
{baseDir}/timestamp.sh relative "next week"
{baseDir}/timestamp.sh relative "in 3 days"bash
{baseDir}/timestamp.sh relative "2 hours ago"
{baseDir}/timestamp.sh relative "tomorrow"
{baseDir}/timestamp.sh relative "next week"
{baseDir}/timestamp.sh relative "in 3 days"Time Difference
时间差计算
bash
{baseDir}/timestamp.sh diff "2024-01-01" "2024-01-10"
{baseDir}/timestamp.sh diff 1704067200 1704153600
{baseDir}/timestamp.sh diff "now" "tomorrow"bash
{baseDir}/timestamp.sh diff "2024-01-01" "2024-01-10"
{baseDir}/timestamp.sh diff 1704067200 1704153600
{baseDir}/timestamp.sh diff "now" "tomorrow"Parse Date String
解析日期字符串
bash
{baseDir}/timestamp.sh parse "January 1, 2024"
{baseDir}/timestamp.sh parse "2024-01-01 12:00:00"
{baseDir}/timestamp.sh parse "01/01/2024"bash
{baseDir}/timestamp.sh parse "January 1, 2024"
{baseDir}/timestamp.sh parse "2024-01-01 12:00:00"
{baseDir}/timestamp.sh parse "01/01/2024"Output Formats
输出格式
| Format | Description | Example |
|---|---|---|
| Unix timestamp | |
| ISO 8601 | |
| Date only | |
| Time only | |
| Date and time | |
| Human readable | |
| Relative time | |
| 格式 | 说明 | 示例 |
|---|---|---|
| Unix时间戳 | |
| ISO 8601格式 | |
| 仅日期 | |
| 仅时间 | |
| 日期和时间 | |
| 人类可读格式 | |
| 相对时间 | |
Examples
示例
Get current Unix timestamp:
bash
{baseDir}/timestamp.sh now --format unix获取当前Unix时间戳:
bash
{baseDir}/timestamp.sh now --format unixOutput: 1704067200
输出: 1704067200
**Convert Unix to ISO:**
```bash
{baseDir}/timestamp.sh convert 1704067200 --format iso
**将Unix时间戳转换为ISO格式:**
```bash
{baseDir}/timestamp.sh convert 1704067200 --format isoOutput: 2024-01-01T00:00:00Z
输出: 2024-01-01T00:00:00Z
**Get time 2 hours from now:**
```bash
{baseDir}/timestamp.sh relative "in 2 hours"
**获取2小时后的时间:**
```bash
{baseDir}/timestamp.sh relative "in 2 hours"Output: 2024-01-01T02:00:00Z
输出: 2024-01-01T02:00:00Z
**Calculate days between dates:**
```bash
{baseDir}/timestamp.sh diff "2024-01-01" "2024-01-31" --unit days
**计算两个日期之间的天数:**
```bash
{baseDir}/timestamp.sh diff "2024-01-01" "2024-01-31" --unit daysOutput: 30 days
输出: 30 days
undefinedundefinedNotes
注意事项
- All operations use UTC by default
- Use for local timezone
--local - Supports various date formats
- Handles relative time expressions
- 所有操作默认使用UTC时区
- 使用参数切换为本地时区
--local - 支持多种日期格式
- 支持处理相对时间表达式