Skip to Content
Back to Actions

Updated

How to Get a Unix Timestamp in Shortcuts on iPhone and Mac

With Actions

  1. Install Actions, and open it once.
  2. In your shortcut, add the “Convert Date to Unix Timestamp” action of Actions.
  3. In the date field, write “current date” for the time of now, or choose a date variable of the shortcut.
  4. Use its result, “Unix Timestamp”, in the next action, like in the request to a web API.

The result is in seconds. For milliseconds, which JavaScript uses, expand the action, and turn on the milliseconds option.

To read a timestamp, like one from a web API, add the “Convert Unix Timestamp to Date” action, and give it the number. It also has an option for a timestamp in milliseconds. The result is a date that the other actions of Shortcuts can use, like “Format Date”.

Get Actions

Additional actions for the Shortcuts app

Download on the App Store

Free

Platforms
macOS, iOS, visionOS
Requires
macOS, iOS, or visionOS 26 or later
Category
Utilities
Released
October 2021
Updated
June 2026
Version
4.2.0
Size
29 MB
US App Store rating
4.8/5 (529 ratings)

More about Actions

Without an app

iPhone and Mac: Add the “Get Time Between Dates” action, and set it to get the seconds between 1 January 1970 at 00:00 and the current date. Write the first date in UTC, or the result can be wrong by the hours of your time zone.

Mac only: Add the “Run Shell Script” action, and type date +%s.

The built-in ways are fine for the timestamp of now, but the time zone of the first date is easy to get wrong. The actions of Actions convert in the two directions, and do not depend on your time zone.