文档

创建、使用和掌握Discord时间相关功能的综合指南。

什么是Discord时间戳?

了解对每个人都有效的时间背后的魔力。

Discord时间戳是一种特殊标记,允许您显示自动转换为每个用户本地时区的日期和时间。当您粘贴时间戳代码时,Discord会读取它并显示为查看者调整的时间,使其完美适用于全球协调。

时间戳语法

如何构建时间戳代码。

Discord时间戳的基本语法是:

<t:1640995200:f>

其中:

  • 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

Unix Timestamp = (Current Date/Time - January 1, 1970 00:00:00 UTC) / 1000

Result is in milliseconds, divide by 1000 to get seconds

Example Conversion

Real-world example of timestamp conversion:

Date: December 31, 2023 23:59:59 UTC
Unix: 1704067199
Discord: <t:1704067199:F>

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.

FormatDiscord CodeExample OutputBest Use Case
t
Short Time
<t:1640995200:t>4:20 PMQuick time mentions
T
Long Time
<t:1640995200:T>4:20:00 PMPrecise time specifications
d
Short Date
<t:1640995200:d>12/31/2021Date-only references
D
Long Date
<t:1640995200:D>December 31, 2021Formal announcements
f
Short Date/Time
<t:1640995200:f>December 31, 2021 4:20 PMStandard event times
F
Long Date/Time
<t:1640995200:F>Friday, December 31, 2021 4:20 PMDetailed schedules
R
Relative Time
<t:1640995200:R>3 years agoDeadlines and countdowns

Time Unit Conversion Reference

Essential time unit conversions for working with Unix timestamps and Discord time codes.

Seconds Conversion Table

Time UnitSeconds
1 minute60
1 hour3,600
1 day86,400
1 week604,800
1 month (30 days)2,592,000
1 year (365 days)31,536,000

Quick Reference Examples

Add 1 Hour
timestamp + 3600
Add 1 Day
timestamp + 86400
Add 1 Week
timestamp + 604800
Subtract 1 Day
timestamp - 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.

我们的工具套件

管理全球社区时间所需的一切。

时间戳生成器和工作台

我们的主要工具帮助您轻松创建时间戳。集成的「时间戳工作台」是一个独特功能,让您一次查看所有可用格式。

  • 使用易于使用的日历选择任何日期和时间。
  • 从单个表格中立即预览和复制任何格式的代码。
前往时间戳生成器 →

时区转换器

跨不同时区规划活动?我们的转换器是完美的工具。

  • 在您的本地时区选择日期和时间。
  • 选择目标时区以查看朋友的确切对应时间。
前往时区转换器 →