AgentSkillsCN

time

时间与时区实用工具,用于获取当前时间并实现时区间的相互转换。适用场景:(1) 在任意时区获取当前时间;(2) 在不同时区之间进行时间转换;(3) 处理 IANA 时区名称;(4) 跨时区安排日程;(5) 执行对时间敏感的操作。触发条件:「现在几点?」、「当前时间」、「时间转换」、「时区」、「[城市] 的时间」。

SKILL.md
--- frontmatter
name: time
description: |
  Time and timezone utilities for getting current time and converting between timezones. Use when: (1) Getting current time in any timezone, (2) Converting time between different timezones, (3) Working with IANA timezone names, (4) Scheduling across timezones, (5) Time-sensitive operations. Triggers: "what time is it", "current time", "convert time", "timezone", "time in [city]".

Time

Time and timezone conversion utilities. Standalone CLI only (no MCP dependency).

Execution Methods

Run scripts/time_cli.py via Bash:

bash
# Prerequisites: pip install pytz (or use Python 3.9+ with zoneinfo)

# Get current time in a timezone
python scripts/time_cli.py get --timezone "Asia/Shanghai"
python scripts/time_cli.py get --timezone "America/New_York"
python scripts/time_cli.py get  # Uses system timezone

# Convert time between timezones
python scripts/time_cli.py convert \
  --time "16:30" \
  --from "America/New_York" \
  --to "Asia/Tokyo"

# List available timezones
python scripts/time_cli.py list [--filter "Asia"]

Tool Capability Matrix

ToolParametersOutput
get_current_timetimezone (required, IANA name){timezone, datetime, is_dst}
convert_timesource_timezone, time (HH:MM), target_timezone{source, target, time_difference}

Common IANA Timezone Names

RegionTimezone
ChinaAsia/Shanghai
JapanAsia/Tokyo
KoreaAsia/Seoul
US EastAmerica/New_York
US WestAmerica/Los_Angeles
UKEurope/London
GermanyEurope/Berlin
FranceEurope/Paris
AustraliaAustralia/Sydney
UTCUTC

Workflow

Getting Current Time

  1. Identify target timezone (use IANA name)
  2. Call get_current_time with timezone parameter
  3. Response includes ISO 8601 datetime and DST status

Converting Time

  1. Identify source timezone and time (24-hour format HH:MM)
  2. Identify target timezone
  3. Call convert_time with all parameters
  4. Response includes both times and time difference

Output Format

get_current_time Response

json
{
  "timezone": "Asia/Shanghai",
  "datetime": "2024-01-01T21:00:00+08:00",
  "is_dst": false
}

convert_time Response

json
{
  "source": {
    "timezone": "America/New_York",
    "datetime": "2024-01-01T16:30:00-05:00",
    "is_dst": false
  },
  "target": {
    "timezone": "Asia/Tokyo",
    "datetime": "2024-01-02T06:30:00+09:00",
    "is_dst": false
  },
  "time_difference": "+14.0h"
}

Error Handling

ErrorRecovery
Invalid timezoneCheck IANA timezone name spelling
Invalid time formatUse 24-hour format HH:MM
MCP unavailableFall back to CLI script

Anti-Patterns

ProhibitedCorrect
Use city names directlyUse IANA timezone names (e.g., Asia/Tokyo not Tokyo)
Use 12-hour formatUse 24-hour format (e.g., 16:30 not 4:30 PM)
Assume timezoneAlways specify timezone explicitly