跳转到内容
POST AI agent ready /v1/timestamp/convert

Unix 时间戳转换器 API - Epoch 到 ISO 8601 和 RFC

在 Unix 纪元(秒或毫秒)、ISO 8601 和 RFC 2822 格式之间转换时间戳。 发送任何可识别的格式并接收所有三种表示形式。

Parameters

stringrequired

The timestamp to convert. Accepts Unix epoch (number), ISO 8601 string, or RFC 2822 string.

string

Source format hint. One of: unix, unix_ms, iso, auto. Defaults to auto.

Code examples

curl -X POST https://api.botoi.com/v1/timestamp/convert \
  -H "Content-Type: application/json" \
  -d '{"timestamp":"1711434800","from":"auto"}'

When to use this API

日志时间戳标准化

将不同服务的混合时间戳格式转换为一致的 ISO 8601 格式,以实现统一日志聚合。

面向用户的日期显示

将数据库中存储的 Unix 时间戳转换为 ISO 8601 字符串,然后将其发送到前端日期格式化库。

API调试

将 API 响应中的纪元时间戳转换为人类可读的日期,以快速验证到期时间、事件日期或缓存标头。

Frequently asked questions

这会自动检测秒与毫秒吗?
是的。 API 根据数字时间戳的大小自动检测其单位是秒还是毫秒。
ISO 输出位于哪个时区?
ISO 8601 输出始终采用 UTC(由 Z 后缀表示)。 在客户端转换为当地时间。
我可以传递人类可读的日期字符串吗?
API 接受 ISO 8601 和 RFC 2822 字符串。 不支持“March 26, 2024”等自由格式字符串。
什么是相对场?
相对字段显示相对于当前服务器时间的人类可读持续时间,例如“2 小时前”或“3 天内”。

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.