system-time
获取各种格式和时区的准确系统时间。当用户需要知道当前时间、日期、时间戳或想要在时区之间进行转换时使用。支持 ISO 8601、Unix 时间戳、人类可读格式和时区转换。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:kn7frkwc3mpdwdb2j3awxqf3q582986b~hengheng-system-timecURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Akn7frkwc3mpdwdb2j3awxqf3q582986b~hengheng-system-time/file -o hengheng-system-time.md## 概述(中文) 获取各种格式和时区的准确系统时间。当用户需要知道当前时间、日期、时间戳或想要在时区之间进行转换时使用。支持 ISO 8601、Unix 时间戳、人类可读格式和时区转换。 ## 原文 # System Time Get accurate system time information in multiple formats. ## Quick Usage ### Current Time (Local) ```bash date # Human readable date -Iseconds # ISO 8601 with seconds date +%s # Unix timestamp ``` ### Current Time (UTC) ```bash date -u # UTC human readable date -u -Iseconds # UTC ISO 8601 date -u +%s # UTC Unix timestamp (same as local) ``` ### Specific Timezone ```bash TZ=Asia/Shanghai date # Shanghai time TZ=America/New_York date # New York time TZ=Europe/London date # London time ``` ## Common Formats | Format | Command | Example Output | |--------|---------|----------------| | ISO 8601 | `date -Iseconds` | 2024-03-11T16:30:00+08:00 | | Unix timestamp | `date +%s` | 1710145800 | | RFC 2822 | `date -R` | Mon, 11 Mar 2024 16:30:00 +0800 | | Custom | `date "+%Y-%m-%d %H:%M:%S"` | 2024-03-11 16:30:00 | ## Timezone Conversion Convert from one timezone to another: ```bash # Convert specific time from Shanghai to New York TZ=America/New_York date -d "2024-03-11 16:30:00 CST" # List available timezones ls /usr/share/zoneinfo/ ``` ## Python Alternative (for scripting) ```python from datetime import datetime, timezone # Current UTC time utc_now = datetime.now(timezone.utc) print(utc_now.isoformat()) # Current local time local_now = datetime.now() print(local_now.isoformat()) # Unix timestamp print(int(utc_now.timestamp())) ``` ## Notes - Unix timestamp is always UTC (timezone-independent) - ISO 8601 format includes timezone offset - Use `timedatectl` on Linux systems for system clock info