Skip to content

Working with Dates and Times

Brad Cannell edited this page Jan 25, 2023 · 6 revisions

Make better later.

Sandbox flows

  • SB - Dates and times. This is a sandbox flow for experimenting with date and time functions.

    • To get today's date as a datetime string: utcNow().

      • This returns the current date and time in Universal Coordinated Time.
      • It takes the form 2023-01-25T16:59:31.1313071Z.
    • To convert the time zone of a datetime string: convertTimeZone()

      • For example, to convert today's date to central time use convertTimeZone(utcNow(), 'UTC', 'Central Standard Time').
      • It take the form 2023-01-25T10:59:31.1781805.
  • Get date from datetime. Add description.

    • formatDateTime(variables('dateTimeToday'),'yyy-MM-dd')
  • Identify tasks created 10 days ago.

    • mod(variables('daysDiffWIP'), 10)

Useful functions

Today's date in ticks: ticks(convertTimeZone(utcNow(), 'UTC', 'Central Standard Time'))

To convert a stored date variable to ticks: ticks(item()?['createdDateTime'])

To convert ticks to days, divide by 864000000000: div(variables('today'), 864000000000)

To find the difference between two dates in ticks: sub(variables('today'),variables('dateCreated'))

To find the difference between two dates in days: div(sub(variables('today'),variables('dateCreated')), 864000000000)

To find out if the number of days is divisible by 7: mod(variables('daysDiffWIP'), 7)

The today() function returns a datetime string 2023-01-25T10:50:46.0611874 in