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 Used

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-set-variable.webp
Set Variable
Sets the value of the specified variable to the input of this action.
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-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.
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.

Extra Details

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

Related Posts

How to quickly link all your YouTube chapter markers using Shortcuts

More From This Folder

More From The Library


Get way deeper into Shortcuts – become a member.