If you’re trying to coordinate with other folks over Discord, you might run into timezone issues – often people in disparate communities live all across the world, and trying to specify exactly when everyone should arrive in their relative time can actually prove to be quite hard.
Thankfully, the folks at Discord ran into this enough themselves that a solution is actually built into the application: a special <t:{timestamp}> message (plus an optional :{format} you can append).
Once you send this timestamp, each person will see the correct time in their timezone. Great!
Now you just need a timestamp… which you can get… how??
Oddly, Discord has no way of actually creating this message itself – it requires a Unix timestamp, which seems to be intended for developers who might be programming a chatbot, for example, rather than everyday users.
Thankfully, you can create that timestamp—and take advantage of Discord’s formatting options—using Apple’s Shortcuts app. Here’s how (plus, what a Unix timestamp really is in the first place):
Each chapter on YouTube must be formatted as a timecode, but making YouTube links to specific timestamps requires a “total seconds” value at the end of the URL, like &t=3600 – something I wasn’t about to do manually for all 90 chapters.
In order to convert everything to the right format quickly and generate URLs to each chapter, I built two shortcuts:
To start, I broke out the timecode functionality into its own shortcut since it is a distinct process, involves some complex calculations, and I wanted to test it while building it without iterating through all my chapters each time.
The shortcut assumes only a timecode value in the 00:00:00 or 00:00 format, checking for either one by splitting at the colon (:) and counting the number of items in the resulting list. If there’s 3 sets of numbers, we’ll need to account for the hour value, and if there’s only 2 values, we only need to multiple the minutes and seconds.
Then, the shortcut gets each item from the list, declares it as a variable (to make the formula easier to understand), and performs a series of calculations to multiple the hour value by 60 to generate the minutes so far, them multiplying that by 60 again and adding the seconds to come to the total value.
As an example, 01:40:32 becomes ((1 x 60) + 40) * 60 + 32 = 6032 total seconds.
If no hour value is given, the “Otherwise” condition is triggered and the shortcut performs the same math, multiplying the total minutes by 60 and adding that to the seconds value as well.
When this shortcut is finished, it outputs the total seconds value – in my next shortcut, this whole shortcut is utilized via the Run Shortcut action, which calls this as a subroutine, taking the timecode as input and passing out the total seconds as a result.
Making a Markdown list of YouTube chapter timestamps
This shortcut starts by accepting the YouTube link as input (either from the Share sheet or provided manually), and then in the second step asks you to paste the full list of chapter markers, which the shortcut repeats through one-by-one.
Inside the repeating process, the shortcut splits out the timecode from the title using my custom format—I always separate them using - (a space, a dash, and a space)— so that, working with the resulting list, the First Item is the timecode, and the Last Item is the title.
Then the shortcut passes the timecode into my converter, and the resulting total seconds value is added onto the video link and placed inside a Markdown-style link.
Once the shortcut repeats through each chapter, generates the link, and formats it as a link list item, the entire Repeat Results are combined onto new lines and passed as output.
In this instance, I put the text into Ulysses using “Paste as Markdown” before publishing it to my blog, but I also plan to use this to paste my linked list into WordPress directly so I didn’t include a final step sharing to Ulysses directly and instead set Stop & Output to Copy to Clipboard.
Link to your YouTube chapters
If you’re a YouTuber who publishes your own videos or livestreams with chapter markers included, you can use this shortcut yourself to create a linked list of all the moments in your video and publish them elsewhere for people to quickly reference – make it easy on them.
Plus, for any other potential use cases for a timecode > total seconds converter, you can get my shortcut as a standalone function – I’ll definitely be reusing this soon…
Yesterday over on Six Colors, Jason Snell wrote about his difficulty helping a friend use the Calendar actions in Shortcuts to pull data from two separate calendars:
Lex wanted to use this shortcut to quickly generate a list of times where he’s available for meetings. This is a great use of automation—I wish I’d thought of it. Unfortunately, the shortcut only checks a single calendar, and Lex wanted his availability judged based on entries in two different calendars.
This thread caught my eye: both because I haven’t personally run into that issue, but also because I had actually thought of the automation.
Here’s my Copy my availability shortcut that I built all the way back when Shortcuts was Workflow, which has managed to live on in the Shortcuts Gallery today as the “Share Availability” shortcut.1
In the piece, Jason came up with a solution after Shortcuts couldn’t get all the data in one action:
As a writer who generally focuses on complicated processes for using technology, I can find it tempting to default to lazy language that over-simplifies for me, but tends to makes things confusing for new users. If something is difficult for everyone else and I describe it as “simple”, I’ve just lost many people who might’ve otherwise made it through.
For example, when I wrote the Workflow documentation, I took care to make sure I avoided assuming the directions given were as straightforward as possible and could always be understood by someone without any technical training (like me).
Today, I came across a great tweet from Jess Telford, summarizing a post from CSS Tricks and originated by Chris Coyier, who message I’ve seen before but am officially copying for my own work. This is aimed at code comments, but the author suggests setting the following words as “errors” in your syntax highlighter:
Obviously
Basically
Simply
Of Course
Clearly
Just
Everyone knows
However
So,
Easy
Using these words in an explainer context is now banned from all of my writing.
Nothing with iOS automation or the technical details of how something works is easy, simple, or clear – at some point, it was explained to you. Not everyone knows, you don’t “just” do something because there’s a verb for that action, and many complex things are rarely obvious how to use at first.
I want to avoid alienating anyone who reads my writing or wants to learn more about how to use technology – the goal is to empower, not educate from above.
If you see me using this language, don’t hesitate to call me out.