Convert timecode to total seconds

Function for taking timecodes like 01:45:30 and adding up the hours or minutes or seconds into a single unit (seconds) that can be used for calculations; or, more specifically, YouTube timestamps.

Actions

shortcuts-action-icon-split-text.webp
Split Text
Separates text passed into the action into a list.
shortcuts-action-icon-count.webp
Count
Counts the number of items, characters, words, sentences, or lines passed as input. Note (from Apple, for real) This is just like the Count in Sesame Street, but instead of a vampire, it’s a Shortcuts action.
shortcuts-action-icon-if.webp
If
Tests if a condition is true, and if so, runs the actions inside. Otherwise, the actions under “Otherwise” are run.
shortcuts-action-icon-get-item-from-list.webp
Get Item from List
Returns one or more items from the list passed as input. You can get the first item, the last item, a random item, the item at a particular index, or items in a range of indexes.
shortcuts-action-icon-set-variable.webp
Set Variable
Sets the value of the specified variable to the input of this action.
action-icon-calculate.webp
Calculate
Performs a number operation on the input and returns the result.
shortcuts-action-icon-stop-and-output.webp
Stop and Output
Stops execution of the current shortcut, and outputs content. This action is useful when: • Running a shortcut from another shortcut (using the Run Shortcut action). The output will be used as the output of the Run Shortcut action. • Running a shortcut from Quick Actions in Finder on macOS. The output will be saved as a file alongside the files selected in Finder. • Running a shortcut from Services on macOS. The output will replace the selected content, if applicable. • Or, when running a shortcut from another location that supports output, like the command-line or the Shortcuts URL scheme. No more actions will be run after this action.

Related Posts

How to quickly link all your YouTube chapter markers using Shortcuts
If you publish YouTube videos or livestreams with chapter markers, you might want to link back to those moments – here's how to generate the full list using Apple's Shortcuts app.

More From This Folder

Extra Details

Link to Run Shortcut
shortcuts://run-shortcut?name=Convert%20timecode%20to%20total%20seconds
Link to Open Shortcut
shortcuts://open-shortcut?name=Convert%20timecode%20to%20total%20seconds
AppleScript code
tell application “Shortcuts Events” run shortcut “Convert timecode to total seconds” end tell

More From The Library


Get way deeper into Shortcuts – become a member.

Browse more