360 Secure SkillHub
360 安全技能中心

Timestamp Toolkit

基于 Python 的命令行工具,提供 now、to-datetime、to-timestamp、format、diff 五个动作,用于 Unix 时间戳与日期时间字符串互转、按自定义格式输出以及计算两时间之差,支持指定时区和秒/毫秒单位。SKILL.md 自述仍在开发中。

freeter226
freeter226
热度 42.99
最近更新 2026-05-11 17:35:03
分类:效率依赖:代码执行应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add timestamp-toolkit
Metadata
name
timestamp-toolkit
description
Timestamp conversion tool. Convert between Unix timestamp, datetime, and various date formats.
metadata
{"openclaw":{"emoji":"🕐","requires":{"bins":["python3"]}}}

Timestamp Toolkit

A simple timestamp conversion and formatting tool.

Features

  • Timestamp to DateTime - Convert Unix timestamp to readable datetime
  • DateTime to Timestamp - Convert datetime string to Unix timestamp
  • Format Conversion - Convert between various date formats
  • Current Time - Get current timestamp in multiple formats
  • Relative Time - Calculate time differences

Usage

python3 skills/timestamp-toolkit/scripts/timestamp.py <action> [options]

Actions

Action Description
now Get current timestamp
to-datetime Convert timestamp to datetime
to-timestamp Convert datetime to timestamp
format Format datetime string
diff Calculate time difference

Options

Option Type Default Description
--input string - Input timestamp or datetime
--format string %Y-%m-%d %H:%M:%S Output format
--tz string local Timezone (local, utc, or timezone name)
--unit string s Timestamp unit (s=seconds, ms=milliseconds)

Examples

# Get current timestamp
python3 skills/timestamp-toolkit/scripts/timestamp.py now

# Convert timestamp to datetime
python3 skills/timestamp-toolkit/scripts/timestamp.py to-datetime --input 1700000000

# Convert datetime to timestamp
python3 skills/timestamp-toolkit/scripts/timestamp.py to-timestamp --input "2024-03-22 14:00:00"

# Format datetime
python3 skills/timestamp-toolkit/scripts/timestamp.py format --input "2024-03-22" --format "%Y年%m月%d日"

# Calculate time difference
python3 skills/timestamp-toolkit/scripts/timestamp.py diff --input "2024-01-01" --input2 "2024-03-22"

Supported Formats

Format Example
ISO 8601 2024-03-22T14:00:00Z
Standard 2024-03-22 14:00:00
Chinese 2024年3月22日 14:00:00
Custom Any Python strftime format

Use Cases

  1. Log Analysis - Convert timestamps in logs to readable format
  2. API Development - Handle timestamp conversions
  3. Data Processing - Normalize time formats
  4. Debugging - Quick timestamp conversions

Current Status

In development.