Time Functions

  • fn.now: Return the date and time at this moment. An optional format parameter is available.

Example:

Example Output
{{fn.now}}



{{fn.now "%Y%m%d"}}

macro.DAY="%A %m/%d/%Y"

{{fn.now macro.DAY}}
2013-04-18 10:50:52.105130



20140327



"Thursday 03/27/2014"

Supported date and time formats:

%a abbreviated weekday name according to the current locale
%A full weekday name according to the current locale
%b abbreviated month name according to the current locale
%B full month name according to the current locale
%c preferred date and time representation for the current locale
%C century number (the year divided by 100 and truncated to an integer, range 00 to 99)
%d day of the month as a decimal number (range 01 to 31)
%D same as m/d/y
%e day of the month as a decimal number, a single digit is preceded by a space (range ‘ 1’ to ‘31’)
%g like G, but without the century
%G The 4-digit year corresponding to the ISO week number
%h same as b
%H hour as a decimal number using a 24-hour clock (range 00 to 23)
%I hour as a decimal number using a 12-hour clock (range 01 to 12)
%j day of the year as a decimal number (range 001 to 366)
%m month as a decimal number (range 01 to 12)
%M minute as a decimal number
%n newline character
%p either ‘AM’ or ‘PM’ according to the given time value, or the corresponding strings for the current locale
%P like p, but lower case
%r time in a.m. and p.m. notation equal to I:M:S p
%R time in 24 hour notation equal to H:M
%S second as a decimal number
%t tab character
%T current time, equal to H:M:S
%u weekday as a decimal number [1,7], with 1 representing Monday
%U week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
%V The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
%w day of the week as a decimal, Sunday being 0
%W week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
%x preferred date representation for the current locale without the time
%X preferred time representation for the current locale without the date
%y year as a decimal number without a century (range 00 to 99)
%Y year as a decimal number including the century
%z numerical time zone representation
%Z time zone name or abbreviation
%% a literal ‘%’ character
  • fn.seconds_to_text: Given an integer seconds value, convert to days, hours, minutes, seconds
Examples Output
{{ fn.seconds_to_text 345435 }}



{{ fn.seconds_to_text 8000 }}



{{ fn.seconds_to_text 35 }}
3 days, 23 hours, 57 minutes,
15 seconds


2 hours, 13 minutes, 20 seconds



35 seconds
  • fn.add_x_days_to_startdate: Given three arguments,

    1. integer number of days (positive or negative value)
    2. start date
    3. date-time format specification

    return a date in the past or future.

    The arguments can be named macros.

Examples Output
{{ fn.add_x_days_to_startdate 10, '2019-10-01',
   '%Y:%m:%d:%I:%M' }}
2019:10:11:02:09
macro.global_setting_cooling_duration = 10
macro.TODAY_YYYY_MM_DD = '2019-10-01'
macro.DateTimeFormatter_YYYY_MM_DD =
  '%Y:%m:%d:%I:%M'


 {{ fn.add_x_days_to_startdate
     macro.global_setting_cooling_duration,
     macro.TODAY_YYYY_MM_DD,
     macro.DateTimeFormatter_YYYY_MM_DD }}
2019:10:11:02:09