← 返回
开发者工具 中文

Epoch

Convert Unix timestamps, compare epochs, and do time arithmetic. Use when converting dates, debugging timestamps, or checking timezone offsets.
转换 Unix 时间戳、比较 epoch、执行时间运算。适用于日期转换、时间戳调试或检查时区偏移。
bytesagain3
开发者工具 clawhub v3.0.0 2 版本 99838.4 Key: 无需
★ 0
Stars
📥 618
下载
💾 3
安装
2
版本
#latest

概述

Epoch

A real Unix timestamp tool for converting, comparing, and calculating epoch timestamps. All conversions use the system date command with support for both local and UTC output.

Commands

CommandDescription
----------------------
epoch nowShow current epoch timestamp + human-readable date (local & UTC)
epoch convert Convert an epoch timestamp to human-readable local, UTC, and age
epoch from Convert a human-readable date string to epoch
epoch diff Calculate difference between two timestamps (seconds, minutes, hours, days)
epoch add Add seconds to a timestamp and show the result
epoch versionShow version
epoch helpShow available commands and usage

Requirements

  • Bash 4+ (set -euo pipefail)
  • date, awk — standard Unix utilities
  • No external dependencies or API keys

When to Use

  1. Quick timestamp lookupepoch now gives you the current epoch + human date instantly
  2. Debugging timestamps in logsepoch convert 1700000000 shows you what that number actually means
  3. Parsing date stringsepoch from '2024-01-15 10:30:00' gets you the epoch value
  4. Calculating time differencesepoch diff shows the gap in every unit
  5. Time arithmeticepoch add 1700000000 3600 adds an hour and shows the result

Examples

# Show current epoch + human-readable date
epoch now

# Convert epoch to date
epoch convert 1700000000

# Convert date string to epoch
epoch from '2024-01-15 10:30:00'
epoch from 'Jan 15 2024'

# Difference between two timestamps
epoch diff 1700000000 1700086400

# Add 1 hour (3600 seconds) to a timestamp
epoch add 1700000000 3600

# Add 7 days to a timestamp
epoch add 1700000000 604800

Example Output

$ epoch now
┌─────────────────────────────────────┐
│  Current Time                       │
├─────────────────────────────────────┤
│  Epoch:  1773916290                 │
│  Human:  2026-03-19 18:31:30 CST   │
├─────────────────────────────────────┤
│  UTC:    2026-03-19 10:31:30 UTC   │
└─────────────────────────────────────┘

$ epoch diff 1700000000 1700086400
┌───────────────────────────────────────────────────┐
│  Timestamp Difference                             │
├───────────────────────────────────────────────────┤
│  From:     1700000000 (2023-11-15 06:13:20 CST)   │
│  To:       1700086400 (2023-11-16 06:13:20 CST)   │
├───────────────────────────────────────────────────┤
│  Seconds:  86400                                   │
│  Minutes:  1440.00                                 │
│  Hours:    24.00                                   │
│  Days:     1.0000                                  │
│  Duration: 1d 0h 0m 0s                             │
└───────────────────────────────────────────────────┘

Powered by BytesAgain | bytesagain.com | hello@bytesagain.com

版本历史

共 2 个版本

  • v3.0.0 当前
    2026-03-29 17:49 安全 安全
  • v1.0.7
    2026-03-19 07:02

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,437
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,481
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,918