AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

获取当前时间

skill-hhhh124hhhh-skillmate-get-current-time · by hhhh124hhhh

获取真实当前时间,防止新闻写作时的时间误判

No reviews yet
0 installs
10 views
0.0% view→install

Install

$ agentstack add skill-hhhh124hhhh-skillmate-get-current-time

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hhhh124hhhh-skillmate-get-current-time)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
6mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of 获取当前时间? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

获取当前时间工具

在撰写新闻类文章时,快速获取当前真实日期和时间,防止将真实新闻误判为"虚构内容"。

📌 核心功能

1. 获取当前时间

  • 获取完整的当前日期和时间
  • 返回多种格式的日期字符串
  • 提供时间戳信息

2. 文章格式化时间

  • 生成新闻文章常用的日期格式
  • 包括:"今天"、"昨天"、"本周"、"本月"等
  • 适用于不同场景的时间表达

3. 日期差异检查

  • 检查目标日期与今天的差异
  • 判断日期是过去、今天还是未来
  • 生成人类可读的时间差描述

🚀 使用方式

方式一:通过Python脚本

from get_current_time import handler

# 1. 获取当前时间
result = handler({"action": "get_current"})
print(result)
# 输出: {
#   "current_date": "2026年01月15日",
#   "current_time": "14:30:25",
#   "year": 2026,
#   "month": 1,
#   "day": 15,
#   "full_datetime": "2026年01月15日 14:30:25",
#   ...
# }

# 2. 获取文章常用格式
result = handler({"action": "format_for_article"})
print(result)
# 输出: {
#   "今天": "2026年01月15日",
#   "今天上午": "2026年01月15日上午",
#   "昨天": "2026年01月14日",
#   "本周": "2026年01月第3周",
#   "本月": "2026年01月",
#   "今年": "2026年",
#   "相对时间_今天": "今天",
#   "相对时间_昨天": "昨天",
#   ...
# }

# 3. 检查日期差异
result = handler({
    "action": "check_date",
    "target_date": "2026-01-20"
})
print(result)
# 输出: {
#   "target_date": "2026年01月20日",
#   "today": "2026年01月15日",
#   "days_difference": 5,
#   "is_future": true,
#   "is_past": false,
#   "is_today": false,
#   "human_readable": "5天后"
# }

方式二:通过命令行

# 获取当前时间
python get_current_time.py --action get_current

# 获取文章格式
python get_current_time.py --action format_for_article

# 检查日期差异
python get_current_time.py --action check_date --target-date "2026-01-20"

方式三:通过Skill工具

在Claude Code中使用Skill工具调用:

from skill import handler

result = handler({
    "skill": "get_current_time",
    "args": {
        "action": "get_current"
    }
})

🎯 使用场景

场景1:撰写突发新闻

在写新闻类文章时,快速获取当前时间:

from get_current_time import handler

time_info = handler({"action": "format_for_article"})

# 文章开头
print(f"今天{time_info['今天上午']},阿里云栖小镇...")

场景2:验证事件时间

检查某个事件是过去还是未来:

from get_current_time import handler

# 检查发布会时间
result = handler({
    "action": "check_date",
    "target_date": "2026-01-15"
})

if result["is_today"]:
    print("就是今天!")
elif result["is_future"]:
    print(f"这是未来事件,发生在{result['human_readable']}")
else:
    print(f"这是过去事件,发生在{result['human_readable']}")

场景3:避免时间误判

在撰写"今天发生"的新闻时,先验证:

from get_current_time import handler

# 检查文章中的日期
dates_to_check = [
    "2026-01-15",  # 发布会
    "2026-02-01",  # 功能上线
    "2025-12-10",  # 公测23天
]

for date_str in dates_to_check:
    result = handler({
        "action": "check_date",
        "target_date": date_str
    })
    print(f"{date_str}: {result['human_readable']}")

# 输出:
# 2026-01-15: 就是今天
# 2026-02-01: 17天后
# 2025-12-10: 36天前

💡 最佳实践

1. 新闻写作前先检查时间

在写任何包含"今天"、"刚才"等时间词的新闻前:

from get_current_time import handler

# 获取当前时间
current = handler({"action": "get_current"})
print(f"当前时间: {current['full_datetime']}")

# 检查事件时间
event = handler({
    "action": "check_date",
    "target_date": "2026-01-15"
})
print(f"事件时间: {event['target_date']}")
print(f"时间差异: {event['human_readable']}")

2. 文章中标注时间来源

**正确写法**:
> 今天(2026年1月15日)上午,阿里云栖小镇...

**错误写法**:
> 今天上午,阿里云栖小镇...(没有具体日期)

3. 验证数据时效性

在引用数据时,检查其时效性:

from get_current_time import handler

# 检查数据发布时间
data_result = handler({
    "action": "check_date",
    "target_date": "2025-09-30"  # QuestMobile三季度数据
})

print(f"数据发布于: {data_result['human_readable']}")

if abs(data_result['days_difference']) > 180:
    print("⚠️ 警告: 数据可能已过时(超过6个月)")

4. 使用相对时间

根据时间差选择合适的表达:

from get_current_time import handler

event = handler({
    "action": "check_date",
    "target_date": "2026-01-10"
})

days = abs(event['days_difference'])

if days == 0:
    expression = "今天"
elif days == 1:
    expression = "昨天"
elif days < 7:
    expression = f"{days}天前"
elif days < 30:
    expression = f"{days//7}周前"
else:
    expression = event['target_date']

print(f"事件发生于{expression}")

📝 返回数据说明

get_current 返回字段

| 字段 | 类型 | 说明 | 示例 | |------|------|------|------| | currentdate | string | 当前日期 | "2026年01月15日" | | currenttime | string | 当前时间 | "14:30:25" | | year | int | 年份 | 2026 | | month | int | 月份 | 1 | | day | int | 日期 | 15 | | weekday | string | 星期几(英文) | "Wednesday" | | fulldatetime | string | 完整日期时间 | "2026年01月15日 14:30:25" | | timestamp | float | Unix时间戳 | 1705319425.123 | | isoformat | string | ISO格式 | "2026-01-15T14:30:25" |

formatforarticle 返回字段

| 字段 | 类型 | 说明 | 示例 | |------|------|------|------| | 今天 | string | 今天日期 | "2026年01月15日" | | 今天上午 | string | 今天上午 | "2026年01月15日上午" | | 今天下午 | string | 今天下午 | "2026年01月15日下午" | | 昨天 | string | 昨天日期 | "2026年01月14日" | | 本周 | string | 本周 | "2026年01月第3周" | | 本月 | string | 本月 | "2026年01月" | | 今年 | string | 今年 | "2026年" | | 相对时间今天 | string | "今天" | "今天" | | 相对时间昨天 | string | "昨天" | "昨天" | | 相对时间本周 | string | "本周" | "本周" | | 相对时间本月 | string | "本月" | "本月" |

check_date 返回字段

| 字段 | 类型 | 说明 | 示例 | |------|------|------|------| | targetdate | string | 目标日期 | "2026年01月20日" | | today | string | 今天日期 | "2026年01月15日" | | daysdifference | int | 天数差 | 5 | | isfuture | bool | 是否未来 | true | | ispast | bool | 是否过去 | false | | istoday | bool | 是否今天 | false | | humanreadable | string | 人类可读差异 | "5天后" |

⚠️ 注意事项

1. 时区问题

脚本使用系统本地时区,确保你的系统时区设置正确。

2. 日期格式

支持的日期输入格式:

  • "2026-01-15" (推荐)
  • "2026年01月15日"
  • "2026/01/15"

3. 跨天判断

"今天"是基于0:00-24:00的完整自然日,不是24小时周期。

4. 时间精度

时间精度到秒,对于大多数新闻场景已足够。

🔧 故障排除

问题1:时间不准确

原因:系统时区设置错误

解决

# Windows
# 控制面板 → 时间和语言 → 设置时区

# Linux/Mac
sudo timedatectl set-timezone Asia/Shanghai

问题2:日期解析失败

原因:日期格式不支持

解决:使用推荐的 "YYYY-MM-DD" 格式

问题3:编码问题(Windows)

原因:Windows控制台编码问题

解决:脚本已自动处理Windows编码问题

📚 相关工具

  • datetime_check.py: 批量检查文章中的日期
  • article_date_validator.py: 验证整篇文章的日期一致性

💻 技术细节

  • 语言:Python 3.7+
  • 依赖:仅使用标准库(datetime, json, sys)
  • 兼容性:Windows, Linux, macOS
  • 性能:毫秒级响应

使用建议:每次撰写新闻类文章前,先运行此脚本获取当前时间,避免时间误判!

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.