Date and Time

Tales Souza Updated by Tales Souza

Dealing with date requires you to understand whichwhere and how to increase or decrease range aimed. Which Function to use? Where to place the correct syntax? How to concatenate Functions in order to customize the result?

Increase or decrease ranges

The Function used for this is datetime_add and you may select what range to modify using the correct syntax. See some examples:

Increasing

  • See you next week, on @(format_date(datetime_add(now(),7,"D"),"D"))
  • See you next month, on @(format_date(datetime_add(now(),1,"M"),"MM/DD"))
  • See you next year, on @(format_date(datetime_add(now(),1,"Y"),"YYYY"))
  • See you in two hours, at @(format_time(datetime_add(now(),2,"h"),"h:mm aa"))
  • See you in half an hour, at @(format_time(datetime_add(now(),30,"m"),"h:mm aa"))

Decreasing

  • I haven't seen you since last week, on @(format_date(datetime_add(now(),-7,"D"),"D"))
  • I haven't seen you since last month, on @(format_date(datetime_add(now(),-1,"M"),"MM/DD"))
  • I haven't seen you since last year, on @(format_date(datetime_add(now(),-1,"Y"),"YYYY"))
  • It has been only two hours since we spoke, on @(format_time(datetime_add(now(),-2,"h"),"h:mm aa"))
  • It has been only half an hour since we spoke, on @(format_time(datetime_add(now(),-30,"m"),"h:mm aa"))

Statements

If format is not specified then the environment's default format is used. The format string can consist of the following characters. Characters like space:,T- and _ are ignored. Any other character is an error.

  • YY - last two digits of year 0-99
  • YYYY - four digits of year 0000-9999
  • M - month 1-12
  • MM - month 01-12
  • D - day of month, 1-31
  • DD - day of month, zero padded 0-31
  • h - hour of the day 1-12
  • hh - hour of the day 01-12
  • tt - twenty four hour of the day 01-23
  • m - minute 0-59
  • mm - minute 00-59
  • s - second 0-59
  • ss - second 00-59
  • fff - milliseconds
  • ffffff - microseconds
  • fffffffff - nanoseconds
  • aa - am or pm
  • AA - AM or PM
  • Z - hour and minute offset from UTC, or Z for UTC
  • ZZZ - hour and minute offset from UTC

How did we do?

Expressions Syntax

Logic expressions

Contact