Browse the docs

parseDate

Reads a date out of text such as 2026-10-24, tomorrow, Mar 5 or next Friday at 3pm.

Details #

parseDate(text, format?) takes one or two arguments and returns a time: seconds since 1970, the kind time and now() return.

Without a format it tries, in order:

  • a plain number, as unix seconds (a number above 100 billion is taken as milliseconds);

  • ISO 8601: 2026-10-24, 2026-10-24T15:30, 2026-10-24T15:30:45Z, 2026-10-24T15:30:45.123+02:00. A date alone means midnight in this Mac's time zone;

  • the calculator's dates: today, tomorrow, yesterday, Mar 5, 5 March 2026;

  • everyday wording found anywhere in the text: next Friday at 3pm, in 2 weeks, Nov 14 at 9:30.

With a format, format is a date pattern such as dd/MM/yyyy HH:mm, and the text has to match it exactly.

Parameters #

Takes 1 to 2 arguments. {{ parseDate(text, b?) }}

Examples #

parseDate("2026-10-24")
→ 1792818000
parseDate("next friday at 3pm")
→ 1794603600
parseDate("24/10/2026", "dd/MM/yyyy")
→ 1792818000

Gotchas #

  • Text with no date in it, and empty text, is an error: parseDate() couldn't find a date in 'banana'.

  • Wording like next Friday is read against the real clock, not a test clock.

  • A plain number such as 2026 is unix seconds, not a year.