文档
创建、使用和掌握Discord 时间相关功能的综合指南。
什么是Discord时间戳?
了解对每个人都有效的时间背后的魔力。
Discord时间戳是一种特殊标记,允许您显示自动转换为每个用户本地时区的日期和时间。当您粘贴时间戳代码时,Discord会读取它并显示为查看者调整的时间,使其完美适用于全球协调。
时间戳语法
如何构建时间戳代码。
Discord时间戳的基本语法是:
其中:
- 1640995200 是特定的时刻,以自1970年1月1日以来的秒数(Unix纪元)计算。
- f 是定义时间戳应如何显示的可选字母。
格式选项
t - 短时间
例如:上午10:20
用法:<t:1640995200:t>T - 长时间
例如:上午10:20:30
用法:<t:1640995200:T>d - 短日期
例如:2021/04/20
用法:<t:1640995200:d>D - 长日期
例如:2021年4月20日
用法:<t:1640995200:D>f - 短日期/时间
例如:2021年4月20日 上午10:20
用法:<t:1640995200:f>F - 长日期/时间
例如:2021年4月20日星期二 上午10:20
用法:<t:1640995200:F>R - 相对时间
例如:2年前
用法:<t:1640995200:R>Understanding Unix Timestamps
Learn how Unix timestamps work and how they power Discord's time system.
The Unix Timestamp Formula
Result is in milliseconds, divide by 1000 to get seconds
Example Conversion
Real-world example of timestamp conversion:
How to Calculate
Manual calculation steps:
- Get current date/time in UTC
- Calculate seconds since Jan 1, 1970
- Use in Discord format: <t:TIMESTAMP:FORMAT>
Discord Format Code Reference
Complete reference table for all Discord timestamp format codes with examples and use cases.
| Format | Discord Code | Example Output | Best Use Case |
|---|---|---|---|
tShort Time | <t:1640995200:t> | 4:20 PM | Quick time mentions |
TLong Time | <t:1640995200:T> | 4:20:00 PM | Precise time specifications |
dShort Date | <t:1640995200:d> | 12/31/2021 | Date-only references |
DLong Date | <t:1640995200:D> | December 31, 2021 | Formal announcements |
fShort Date/Time | <t:1640995200:f> | December 31, 2021 4:20 PM | Standard event times |
FLong Date/Time | <t:1640995200:F> | Friday, December 31, 2021 4:20 PM | Detailed schedules |
RRelative Time | <t:1640995200:R> | 3 years ago | Deadlines and countdowns |
Time Unit Conversion Reference
Essential time unit conversions for working with Unix timestamps and Discord time codes.
Seconds Conversion Table
| Time Unit | Seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3,600 |
| 1 day | 86,400 |
| 1 week | 604,800 |
| 1 month (30 days) | 2,592,000 |
| 1 year (365 days) | 31,536,000 |
Quick Reference Examples
timestamp + 3600timestamp + 86400timestamp + 604800timestamp - 86400💡Pro Tip
When working with timestamps, always perform calculations in seconds, then convert to your desired format. This prevents floating-point errors and ensures accuracy.
我们的工具套件
管理全球社区时间所需的一切。
时间戳生成器和工作台
我们的主要工具帮助您轻松创建时间戳。集成的「时间戳工作台」是一个独特功能,让您一次查看所有可用格式。
- 使用易于使用的日历选择任何日期和时间。
- 从单个表格中立即预览和复制任何格式的代码。