I spend a lot of time in Discord. Right now, it’s probably the social media app I use the most. Part of this is probably because I help run the Relay FM Members Discord, a fun group of nerds from all over the world who like the same things I do. Because this community is so widespread and spread out, and because some events are sometimes live-streamed, people often have to deal with timezone conversion.
For example, when sharing a keyboard group buy date or putting the next live podcast stream on your calendar.
Thanks to the recent addition of Unix timestamp message formatting to Discord, you can now send a string that automatically shows the correct client-side time. So, instead of saying “Hey, the game is on August 20 at 12 PM CDT,” which everyone would have to translate on their end, I can say “Hey, the game is on t:1629478800>,” and Discord will automatically convert that Unix timecode into the user’s local time. It kind of looks like this:
But, of course, who can convert human-readable time to Unix time (seconds since midnight UTC on January 1, 1970) on the fly? I know I can’t do it, but Siri Shortcuts sure can!
Discord Developer Portal For Time Stamp Styles
Link: https://discord.com/developers/docs/reference#message-formatting-timestamp-styles
STYLE | EXAMPLE OUTPUT | DESCRIPTION |
---|---|---|
t | 16:20 | Short Time |
T | 16:20:30 | Long Time |
d | 20/04/2021 | Short Date |
D | 20 April 2021 | Long Date |
f * | 20 April 2021 16:20 | Short Date/Time |
F | Tuesday, 20 April 2021 16:20 | Long Date/Time |
R | 2 months ago | Relative Time |
Generating Discord Unix Time in Shortcuts
This is exactly the kind of thing that Shortcuts is great at. It takes tasks that are usually boring but could be useful and mostly takes away the boring parts. In this case, I made a Shortcut that can quickly make the Unix timecode that Discord needs to do its client-local-time magic.
I started with something simple: I wanted a shortcut to take the Current Date/Time, convert it to the Unix timecode, put it in its place in the t:[timecode]> format, and copy it to my clipboard. That only took three Shortcuts:
But once I had the most basic form of a Shortcut, I had to start thinking about ways to make it better and special cases. First of all, I wanted to be able to choose something other than the current date and time. This was an easy change to pick; I just swapped in a Choose Date action, which works well for both the Current Date and any other date.
Then I added the ability to scan your clipboard for text that contains a date, in case I wanted to copy a message from Discord and quickly convert the date in that message. Apple makes it easy by giving you a Get Dates From Input action, which is usually smart enough to pick out dates and times from fairly long strings of text (I think it’s the same system that finds dates in iMessages).
With a little bit of error handling and some extra actions to automatically reopen Discord and give some helpful feedback, the final shortcut for this simple Discord trick is ready.
Now, when I talk about or read about an event in Discord, I can quickly change the date and time of that event into a more useful format for everyone in the server by tapping a button.
Discord Shortcuts And Systems: Start Simple, Then Sprawl
I wanted to write about this Siri Shortcut for an obscure Discord feature not because I think a lot of people will find it useful, but because it shows well how I usually end up using Shortcuts: I have a small “mosquito task” problem that I can solve with a few Shortcuts actions, but I really solve it when I take the time to make the Shortcut as complete as possible. I start small and then add to the tool to build it more useful and, hopefully, able to solve the problems and meet the needs of Future-Me.
I find that a lot of the ways I solve problems follow the same pattern: I find the “last step” of the solution and then build a system around that “last step” to prepare for things I didn’t expect. I think this way of thinking can help people who try to make systems for themselves but don’t end up using them. Sometimes, you need to take the time to make your system as appealing as possible for Future-You to get them to use the system you’ve built for them.