Slack timestamp generator
Make a Slack <!date> string that shows each reader the date and time in their own zone, and see what they get before a bot posts it.
Make a Slack date string
Unix time 1392734382 = 2014-02-18T14:39:42Z
<!date^1392734382^{date_short_pretty} at {time}|Feb 18, 2014 at 2:39 PM UTC>Slack draws the date in each reader's own device time zone, so two people can see different days for the same string. Loading your time zone...
Every token for this date
What a reader in UTC sees now. Copy gives a full string with that one token.
| Token | Reader sees | Full string |
|---|---|---|
| {date_num} Numeric date with leading zeros. Always shows the year. | 2014-02-18 | |
| {date} Full month and ordinal day. Year dropped within 182 days of now. | February 18th | |
| {date_short} Short month. Year dropped within 182 days of now. | Feb 18 | |
| {date_long} Weekday, month, and ordinal day. Year dropped within 182 days. | Tuesday, February 18th | |
| {date_pretty} Like {date}, but today, yesterday, or tomorrow when it fits. | Today | |
| {date_short_pretty} Like {date_short}, but today, yesterday, or tomorrow when it fits. | Today | |
| {date_long_pretty} Like {date_long}, but today, yesterday, or tomorrow when it fits. | Today | |
| {time} 12-hour with AM/PM, or 06:39 when the reader uses 24-hour time. | 2:39 PM | |
| {time_secs} Time with seconds. 06:39:42 in 24-hour time. | 2:39:42 PM | |
| {ago} Relative time: 5 minutes ago, 3 hours ago, in 2 days. | 1 hour ago | |
| {date_slash}not in docs Not in the docs. Month/day/year for US English readers. | 02/18/2014 | |
| {date_short_full}not in docs Not in the docs. Like {date_short}, but always shows the year. | Feb 18, 2014 | |
| {date_long_full}not in docs Not in the docs. Like {date}, but always shows the year. | February 18th, 2014 |
Converters and API referencedate string or Unix time to a date, message ts, thread_ts, syntax
Read a Slack date or Unix timestamp
Paste a <!date^...> string, a Unix timestamp in seconds or milliseconds, or an ISO date.
Read as: Slack <!date> string
{date} at {time} · Fallback: February 18th, 2014 at 6:39 AM PST- In UTC
- Tuesday, February 18, 2014 at 2:39:42 PM UTC
- UTC (ISO 8601)
- 2014-02-18T14:39:42.000Z
- Unix seconds
- 1392734382
- Unix milliseconds
- 1392734382000
- Relative
- 1 hour ago
Message ts and thread_ts
Paste a message ts like 1392734382.000200 or a message link from Copy link.
- Message ts
- 1392734382.000200
- thread_ts
- 1392734300.000100
- Channel
- C024BE91L
- In UTC
- Tuesday, February 18, 2014 at 2:39:42 PM UTC
- UTC (ISO 8601)
- 2014-02-18T14:39:42.000Z
Date to ts
The date picked above, as a ts for the oldest and latest filters of conversations.history.
- ts
- 1392734382.000000
- Written in
- Feb 18, 2014 at 2:39:42 PM UTC
curl -G https://slack.com/api/conversations.history \ -H "Authorization: Bearer $SLACK_TOKEN" \ -d channel=C024BE91L \ -d oldest=1392734382.000000
<!date> rules
- Syntax
<!date^timestamp^token_string^optional_link|fallback_text>. The timestamp is Unix time in whole seconds. The link turns the date into a link. Notifications and older clients show the fallback.- Missing year
- Slack drops the year from {date}, {date_short} and {date_long} when the date is less than 182 days from now, past or future. Use {date_num}, {date_short_full} or {date_long_full} to always show it.
- Time zone
- Slack uses the reader's device zone, not the zone in Slack preferences. {time} follows the reader's 12 or 24-hour clock, and the pretty tokens count today in the reader's zone.
- thread_ts
- The ts of the message that started a thread. Pass it to chat.postMessage to reply in the thread. A link copied from a reply ends in ?thread_ts=.
- oldest / latest
- conversations.history filters take a ts. Date to ts above writes the Unix seconds followed by .000000.
Working across time zones? The Slack timezone converter shows each teammate's hours. For Discord, use the Discord timestamp generator.
How to add a local-time date to a Slack message
- Pick the date, time, and the zone that time is written in.
- Click tokens such as {date_short_pretty} or {time} to build the text. Words around them stay as typed.
- Pick a reader zone to see what that person gets, then press Copy.
- Put the string in the text of chat.postMessage, an incoming webhook, or a Block Kit mrkdwn field. Typed into the Slack message box, it stays as typed.
Frequently asked questions
How do I show a time in each reader's time zone in Slack?
Send the time as a date string: <!date^1392734382^{date_short_pretty} at {time}|Feb 18, 2014 at 6:39 AM PST>. The number is the Unix timestamp in seconds, the part in braces is the format, and the text after | is the fallback. Slack replaces it with the date in each reader's time zone, so a reader in Seoul and one in New York each see their own local time.
Why does Slack show the fallback text or the raw <!date> code?
We posted broken strings to a real Slack DM to check. An unknown token such as {day} makes Slack show the fallback text. Slack shows the raw code when the timestamp is in milliseconds (13 digits), negative, or has a decimal point, when the token string contains a ^, and when the fallback is missing or empty. A | inside the token string ends it early, and everything after the | becomes fallback text.
Can I use <!date> in a message I type in Slack?
No. When we typed a <!date^...> string into the Slack message box and sent it, Slack showed the characters as typed. The syntax works in text an app sends: chat.postMessage, incoming webhooks, and mrkdwn text in Block Kit. For a date in your own message, write it in words or use Slack reminders and scheduled messages.
How do I convert a Slack message ts to a date?
A message ts such as 1392734382.000200 is the Unix time in seconds, a dot, and six more digits. The part before the dot is when the message was sent. The six digits keep the ts unique inside the channel, so treat the whole string as the message ID and never round it. Open Converters and API reference on this page and paste a ts or a message link to see the date.
Related reading
Slack Green does one thing: it keeps your Slack presence dot green while you are actually working, so a quiet keyboard does not mark you away. Try it free.