All Collections
Advanced
Using Time Variables
Using Time Variables
Patrick avatar
Written by Patrick
Updated over a week ago

Sometimes you need to use or a display the current time, some time in the past or some time in the future.

You may want a dashboard showing all transactions in the last 7 days, or all logs from the past 2 hours.

Either way, you can accomplish this easily using Frontly's custom time variables, with relative time support.

And the best part? With the custom time variable, you input the date format you want!


Supported Timeframes:

Years, Months, Days, Minutes, Hours, Seconds

Supported Modifications

Add, Subtract


Date/Time Format Documentation

Year

  • YYYY: 4-digit year (e.g., 2023)

  • YY: 2-digit year (e.g., 23)

Month

  • MMMM: Full month name (e.g., January)

  • MMM: Short month name (e.g., Jan)

  • MM: 2-digit month number, zero-padded (e.g., 01 for January)

  • M: Month number (e.g., 1 for January)

Day (of the Month)

  • DD: 2-digit day number, zero-padded (e.g., 09 for 9th of the month)

  • D: Day number (e.g., 9 for 9th of the month)

Day (of the Week)

  • dddd: Full weekday name (e.g., Monday)

  • ddd: Short weekday name (e.g., Mon)

Hour

  • HH: 2-digit hour, 24-hour format, zero-padded (e.g., 14 for 2 PM)

  • H: Hour, 24-hour format (e.g., 14 for 2 PM)

  • hh: 2-digit hour, 12-hour format, zero-padded (e.g., 02 for 2 AM or 2 PM depending on AM/PM)

  • h: Hour, 12-hour format (e.g., 2 for 2 AM or 2 PM depending on AM/PM)

Minute

  • mm: 2-digit minute, zero-padded (e.g., 07)

  • m: Minute (e.g., 7)

Second

  • ss: 2-digit second, zero-padded (e.g., 05)

  • s: Second (e.g., 5)

AM/PM

  • A: Uppercase AM or PM (e.g., AM)

  • a: Lowercase am or pm (e.g., am)


Examples

Below are examples of different ways you can use Frontly's time variables:

Important: Combining dates, months and years is format-sensitive, so how you set up your variable format will depend on how your data is set up. Use hyphens for your variable (-) if your Sheet data is separated by hyphens, use slashes (/) for your variable if your Sheet data is separated by slashes.

Current Date

{{ time.custom.YYYY-MM-DD }}

Current Date & Time

{{ time.custom.YYYY-MM-DD hh:mm:ss }}

Current Month & Day

{{ time.custom.MM-DD }}

7 Days From Now

{{ time.custom.YYYY-MM-DD.add_days.7 }}

5 Days Ago

{{ time.custom.YYYY-MM-DD.subtract_days.5 }}

30 Minutes From Now

{{ time.custom.YYYY-MM-DD hh:mm.add_minutes.30 }}

Did this answer your question?