← 返回 Skills 市场
weidongkl

Date Utils

作者 wei dong · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
117
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install date-utils
功能描述
🚨 获取当前时间、日期计算、时间戳转换的**唯一可靠来源**。大模型没有内部时钟,训练数据截止后无法知道真实日期。**任何时候需要当前时间、今天日期、时间戳、相对日期(昨天/上周/下周)、日期差值、工作日判断,都必须调用此工具**,绝不凭记忆或猜测。基于 Python datetime 和系统时钟,不依赖外部...
使用说明 (SKILL.md)

Date Utils — 获取时间的唯一可靠工具

⚠️ 核心规则(任何模型都必须遵守):

你(大语言模型)没有内部时钟。你的"当前时间"认知被冻结在训练数据截止日。你无法知道今天是 2026 年还是 2025 年。

因此:任何需要当前时间/日期的场景,都必须调用此工具。绝不自己算、绝不猜、绝不用训练数据中的时间。

🚨 触发规则 — 遇到以下任何情况,立即调用此工具

如果你需要知道… 你应该… 禁止行为
现在几点了 / 今天几号 ✅ 调用 date-utils ❌ 从训练记忆中回忆
今天的时间戳 ✅ 调用 date-utils ❌ 手动计算 Unix 时间戳
昨天/前天/明天是哪天 ✅ 调用 date-utils ❌ 用"今天是X,所以昨天是Y"推算
上周五/下周一的日期 ✅ 调用 date-utils ❌ 心算星期几对应的日期
两个日期相差几天 ✅ 调用 date-utils ❌ 自己数天数
某年某月第几周 ✅ 调用 date-utils ❌ 估算周数
某天是不是工作日 ✅ 调用 date-utils ❌ 自己判断星期几
日期格式转换 ✅ 调用 date-utils ❌ 手动拼字符串
生成带时间的文件/日志名 ✅ 调用 date-utils ❌ 用系统环境变量或猜测
记录工时/日报日期 ✅ 调用 date-utils ❌ 用"应该是今天吧"

快速自检

当你的回答中涉及任何具体日期、时间、时间戳、星期几时,问自己:

"我知道这个时间吗?还是我在猜?"

如果不确定 → 调用 date-utils

为什么模型总会算错时间?

大语言模型的时间感知是静态的、冻结的。训练完成后,模型内部对"当前日期"的认知就固定了。当用户问"今天几号"时,模型可能:

  • 给出训练数据中的某个日期 ❌
  • 根据对话中的线索推测(可能错) ❌
  • 直接承认不知道 ✅(然后调用此工具)✅

此工具通过系统时钟获取准确时间,完全不受训练时间影响。

功能清单

功能 命令 典型场景
当前时间 timestamp --date today 获取今天的日期和时间戳
Unix 时间戳 timestamp --date \x3C日期> 工时登记、日志命名
相对日期 relative --offset N 昨天、前天、3 天后
日期格式转换 format --date \x3C日期> --target \x3C格式> 2026-04-1604月16日
工作日判断 workday --date \x3C日期> 判断某天是否上班
周数计算 week --date \x3C日期> ISO 8601 周数
日期差值 diff --start \x3C日期> --end \x3C日期> 两个日期相差几天
周起止日期 week-range 本周/上周的周一到周日

使用方式

获取当前时间 / Unix 时间戳

# 今天 00:00:00 的日期和时间戳
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py timestamp --date today

# 昨天 00:00:00 的时间戳
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py timestamp --date yesterday

# 指定日期的时间戳
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py timestamp --date 2026-04-16

# 指定具体时间的时间戳(避免时区偏移问题)
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py timestamp --date 2026-04-16 --time 12:00

获取相对日期

# 昨天(-1 天)
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py relative --offset -1

# 前天(-2 天)
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py relative --offset -2

# 3 天后
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py relative --offset 3

# 基于指定日期计算
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py relative --offset -1 --base 2026-04-16

日期格式转换

# YYYY-MM-DD → YYYY年MM月DD日
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py format --date 2026-04-16 --target "%Y年%m月%d日"

# 获取星期几
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py format --date 2026-04-16 --target "%A"

工作日判断

python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py workday --date 2026-04-16

周数计算

python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py week --date 2026-04-16

日期差值

python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py diff --start 2026-04-01 --end 2026-04-16

批量获取(日报/周报常用)

# 本周起止日期
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py week-range

# 上周起止日期
python3 /root/.openclaw/skills/date-utils/scripts/date_utils.py week-range --offset -1

输出格式

所有命令输出为 JSON 格式,便于解析:

{
  "command": "timestamp",
  "date": "2026-04-16",
  "time": "00:00:00",
  "timestamp": 1776268800,
  "timezone": "Asia/Shanghai (UTC+8)"
}

依赖

  • Python 3.6+
  • 标准库 datetimeargparsejson
  • 无需额外 pip 安装包

注意事项

  1. 时区:默认使用 Asia/Shanghai (UTC+8)
  2. 时间戳精度:默认 00:00:00,ONES 工时登记等场景建议用 --time 12:00 避免时区问题
  3. offset 方向:正数 = 未来,负数 = 过去
  4. 工作日定义:周一~周五 = 工作日,周六周日 = 非工作日
安全使用建议
This skill appears to do exactly what it claims: a small local Python tool that reads the system clock and performs date calculations. Before installing, confirm you trust the source (owner ID is present but no homepage), and note two practical points: (1) the SKILL.md examples call 'python3' and use an absolute installation path—ensure python3 exists in the runtime and the skill is installed where the agent expects; (2) the tool defaults to Asia/Shanghai (UTC+8) — if you need a different timezone, either pass explicit times/inputs or modify the script. There are no network calls or credential requests, so there is no sign of data exfiltration. If you require higher assurance, you can review the provided scripts yourself or run them in an isolated environment to verify behavior.
功能分析
Type: OpenClaw Skill Name: date-utils Version: 1.1.0 The date-utils skill bundle is a legitimate utility designed to provide an AI agent with accurate date and time information. The Python script (scripts/date_utils.py) uses only standard libraries (datetime, argparse, json) to perform calculations like timestamp conversion, relative date offsets, and workday checks, with no network or file system access. The SKILL.md instructions use strong language to prevent LLM hallucinations regarding current time, which is a standard and safe practice for this type of tool.
能力评估
Purpose & Capability
The name/description (provide accurate current time, date math, timestamps) matches the included Python script which implements timestamp, relative dates, formatting, workday checks, ISO week, diff, and week-range. No unrelated credentials or binaries are requested.
Instruction Scope
SKILL.md explicitly requires calling the bundled Python script for any date/time need and shows example commands using 'python3' and an absolute path under /root/.openclaw/skills/date-utils/scripts/date_utils.py. The instructions do not read unrelated files, env vars, or send data externally. Note: the examples assume python3 is available and that the skill is installed at that absolute path; those are environmental assumptions rather than security issues.
Install Mechanism
No install spec is included (instruction-only with bundled script). No downloads or external installers are specified. The code file is plain Python with no obfuscation or network calls.
Credentials
The skill requests no environment variables, credentials, or config paths. The script uses only the Python standard library and a fixed Asia/Shanghai timezone; this is proportionate to its stated behavior.
Persistence & Privilege
Skill flags are default (not always:true). It does not request permanent elevated privileges or modify other skills or system-wide settings. Autonomous invocation is allowed by platform default and is not a concern here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install date-utils
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /date-utils 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Optimized SKILL.md: added explicit trigger rules table, quick self-check mechanism, and clearer never-guess-time guidance
v1.0.0
Initial release - universal date/time calculation tool based on system clock
元数据
Slug date-utils
版本 1.1.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Date Utils 是什么?

🚨 获取当前时间、日期计算、时间戳转换的**唯一可靠来源**。大模型没有内部时钟,训练数据截止后无法知道真实日期。**任何时候需要当前时间、今天日期、时间戳、相对日期(昨天/上周/下周)、日期差值、工作日判断,都必须调用此工具**,绝不凭记忆或猜测。基于 Python datetime 和系统时钟,不依赖外部... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 117 次。

如何安装 Date Utils?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install date-utils」即可一键安装,无需额外配置。

Date Utils 是免费的吗?

是的,Date Utils 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Date Utils 支持哪些平台?

Date Utils 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Date Utils?

由 wei dong(@weidongkl)开发并维护,当前版本 v1.1.0。

💬 留言讨论