Date Variables
|
Variable |
Action or Value |
Example |
|
[DATE] [DATEUTC] |
Current Date in server's zone Current Date in UTC |
7/16/2015 |
|
[YEAR] [YEARUTC] |
Current Year in server's zone Current Year in UTC |
2015 |
|
[MONTH] [MONTHUTC] |
Current Month in server's zone Current Month in UTC |
7 |
|
[MONTHNAME] [MONTHNAMEUTC] |
Current Month Name in server's zone Current Month Name in UTC |
July |
|
[MONTHSTART(num)] [MONTHEND(num)] [MONTHSTART(date|num)] [MONTHEND(date|num)] |
Returns first or last date of the month. If num is empty then it uses today's date to find first or last of this month. num - number of months from now. Use negative numbers to compute back months. date - If date value is supplied then the computation stars with that date instead of the current date. |
[MONTHSTART()] = First day of the current month [MONTHEND()] = Last day of the current month [MONTHSTART(2)] = First day of the month 2 months from now [MONTHEND(-3)] = Last day of the month 3 months ago |
|
[QUARTERSTART(num)] [QUARTEREND(num)] [QUARTERSTART(date|num)] [QUARTEREND(date|num)] |
Returns first or last date of the calendar quarter. Quarters are January–March, April–June, July–September and October–December. If num is empty then it uses today's date to find first or last of this quarter. Keep the parentheses even when they are empty: **[QUARTERSTART()]** works, but **[QUARTERSTART]** on its own returns nothing. num - number of quarters from now. Use negative numbers to compute back quarters. date - If date value is supplied then the computation starts with that date instead of the current date. |
[QUARTERSTART()] = First day of the current quarter [QUARTEREND()] = Last day of the current quarter [QUARTERSTART(-1)] = First day of last quarter [QUARTEREND(-1)] = Last day of last quarter [QUARTERSTART(5/15/2026)] = 4/1/2026 [QUARTEREND(11/15/2026|1)] = 3/31/2027 |
|
[YEARSTART(num)] [YEAREND(num)] [YEARSTART(date|num)] [YEAREND(date|num)] |
Returns first or last date of the year. If num is empty then it uses today's date to find first or last of this year. num - number of years from now. Use negative numbers to compute back years date - If date value is supplied then the computation stars with that date instead of the current date. |
[YEARSTART()] = First day of the current year [YEAREND()] = Last day of the current year [YEARSTART(2)] = First day of the year 2 years from now [YEAREND(-3)] = Last day of the year 3 years ago |
|
[DATETIME] [DATETIMEUTC] |
Current Date and Time in server's zone Current Date and Time in UTC |
7/16/2015 10:48 |
|
[DATETIMEFULL] [DATETIMEFULLUTC] |
Current Time including seconds in server's zone Current Time including seconds in UTC |
7/16/2015 10:48:34 |
|
[TIME] [TIMEUTC] |
Current Time in server's zone Current Time in UTC |
10:48 AM |
|
[TIMEFULL] [TIMEFULLUTC] |
Current Time including in server's zone Current Time including in UTC |
10:48:34 AM |
|
[DATE()] [DATE(#)] [DATE(#|Period)] [DATE(Date|#|Period)] [DATE(Date|#|Period|Format)] [DATE(Date|#|Period|Format|DayOfWeek)] |
Date - The date to start from. If it is left out, the computation starts from the current date and time in the server's zone. - The number of periods to add. Use a negative number to go back. Default is 0.Period - What # counts. Default is D (days). Possible values:
Capital M is months and small m is minutes. Any other value counts days. Format - How the result is shown. See the [FORMAT()] variable for the format codes. If Format is left out, the result is the date alone when its time is midnight, otherwise the date and time without seconds. DayOfWeek - Moves the result to the next day of that type after the computed date. If the computed date is already that day, the result is one week later. Put a minus sign in front to go back instead: -MON gives the Monday on or before the computed date. Possible values:
Separate the values with |. To skip a value in the middle, keep its |, as in [DATE(1/1/2024||||MON)]. Make sure a date you send in has a value. If a field used as Date is blank, the blank is read as # instead, so [DATE([DueDate]|4)] with an empty DueDate returns the current date rather than 4 days later. |
[DATE()] = Current date and time [DATE(4)] = Current date and time + 4 days [DATE(4|B)] = Current date and time + 4 business days [DATE(1/1/2024|4|B)] = 1/5/2024 [DATE(1/1/2018|2|W)] = 1/15/2018 [DATE(1/31/2018|1|M)] = 2/28/2018 [DATE(1/1/2018 3:00 PM|90|m)] = 1/1/2018 4:30 PM [DATE(1/1/2018|0|D|yyyy-MM-dd)] = 2018-01-01 [DATE(1/1/2018|1|M|MMMM d, yyyy)] = February 1, 2018 [DATE(1/1/2024||||MON)] = 1/8/2024 (1/1/2024 is a Monday, so the next one) [DATE(1/3/2024||||-MON)] = 1/1/2024 (the Monday on or before 1/3/2024) [DATE(1/1/2024|0|D||FRI)] = 1/5/2024 [DATE([EXDATE]||||MON)] = The Monday after the date in the EXDATE field |
|
[DATETIMEFULL(Date|#|Period|Format)] [TIME(Date|#|Period|Format)] [TIMEFULL(Date|#|Period|Format)] [DATEUTC(Date|#|Period|Format)] [DATETIMEUTC(Date|#|Period|Format)] [DATETIMEFULLUTC(Date|#|Period|Format)] [TIMEUTC(Date|#|Period|Format)] [TIMEFULLUTC(Date|#|Period|Format)] |
These work like [DATE()] above and take the same values. They differ in what they return when no Format is given: [DATETIMEFULL()] returns the date and time including seconds, [TIME()] returns the time, and [TIMEFULL()] returns the time including seconds. The UTC versions compute the same thing in UTC. If Date is not supplied they start from the current date and time in UTC. If a Date is supplied it is read as a date in the server's zone and changed to UTC before the periods are added. [DATEUTC()] returns the date, [DATETIMEUTC()] the date and time, [DATETIMEFULLUTC()] the date and time including seconds, [TIMEUTC()] the time and [TIMEFULLUTC()] the time including seconds. The day, month, year, hour, minute and second variables work the same way in UTC: [DAYUTC()], [DOMUTC()], [DOWUTC()], [DOYUTC()], [MONTHUTC()], [MONTHNAMEUTC()], [YEARUTC()], [HOURUTC()], [MINUTEUTC()] and [SECONDUTC()] take a date and a number just like their versions without UTC. To get seconds in the result, the date you send in must have seconds. [DATE(2)] has none, so [DATETIMEFULLUTC([DATE(2)])] always ends in :00. Use [DATETIMEFULLUTC(2)] instead. |
These examples assume the server's zone is US Central time, which is 6 hours behind UTC in November. [DATETIMEFULL(11/19/2026 3:04:05 PM)] = 11/19/2026 3:04:05 PM [TIME(11/19/2026 3:04:05 PM)] = 3:04 PM [DATETIMEFULL(2)] = Current date and time + 2 days, including seconds [DATETIMEFULLUTC(11/19/2026 3:04:05 PM)] = 11/19/2026 9:04:05 PM [DATEUTC(11/19/2026 9:30 PM)] = 11/20/2026 [DATETIMEFULLUTC(2)] = Current date and time in UTC + 2 days, including seconds [DATETIMEFULLUTC(4|H)] = Current date and time in UTC + 4 hours [DATETIMEFULLUTC([DueDate])] = The DueDate field changed to UTC [HOURUTC(11/19/2026 3:04:05 PM)] = 21 |
|
[DATEONLY()] [DATEONLY(#|Period)] [DATEONLY(Date|#|Period|Format|DayOfWeek)] |
Works like [DATE()] and takes the same values. The difference is the starting point: when no Date is sent in, [DATEONLY()] starts from midnight today instead of the current time, so the result is the date alone. It shows a time only when one is added with H, m or S, or when the Date sent in has a time. |
[DATEONLY()] = Current date [DATEONLY(3)] = Current date + 3 days [DATEONLY(1|H)] = Current date at 1:00 AM |
|
[DATE([EXDATE]||||MON)] |
Next Monday after [EXDATE] |
7/18/2016 12:34 PM |
|
[DATETIME(Date|#|Period|Format|DayOfWeek)] [DATETIMEFULL(Date|#|Period|Format|DayOfWeek)] [TIME(Date|#|Period|Format|DayOfWeek)] [TIMEFULL(Date|#|Period|Format|DayOfWeek)] [DATEUTC(Date|#|Period|Format|DayOfWeek)] [DATETIMEUTC(Date|#|Period|Format|DayOfWeek)] [DATETIMEFULLUTC(Date|#|Period|Format|DayOfWeek)] [TIMEUTC(Date|#|Period|Format|DayOfWeek)] [TIMEFULLUTC(Date|#|Period|Format|DayOfWeek)] |
These work like [DATE()] and take the same values. They differ in what they return when no Format is given: [DATETIME()] returns the same as [DATE()], [DATETIMEFULL()] returns the date and time including seconds, [TIME()] returns the time and [TIMEFULL()] returns the time including seconds. The UTC versions compute the same thing in UTC. If Date is left out they start from the current date and time in UTC. If a Date is sent in, it is read as a date in the server's zone and changed to UTC before the periods are added. [DATEUTC()] returns the date, [DATETIMEUTC()] the date and time, [DATETIMEFULLUTC()] the date and time including seconds, [TIMEUTC()] the time and [TIMEFULLUTC()] the time including seconds. The day, month, year, hour, minute and second variables have UTC versions that work the same way: [DAYUTC()], [DOMUTC()], [DOWUTC()], [DOYUTC()], [MONTHUTC()], [MONTHNAMEUTC()], [YEARUTC()], [HOURUTC()], [MINUTEUTC()] and [SECONDUTC()] take a date and a number just like their versions without UTC. To get seconds in the result, the date you send in must have seconds. [DATE(2)] has none, so [DATETIMEFULLUTC([DATE(2)])] always ends in :00. Use [DATETIMEFULLUTC(2)] instead. |
[DATETIMEFULL(1/1/2018 3:04:05 PM|1)] = 1/2/2018 3:04:05 PM [TIME(1/1/2018 3:04:05 PM|30|m)] = 3:34 PM [TIMEFULL(1/1/2018 3:04:05 PM)] = 3:04:05 PM [DATETIMEFULL(2)] = Current date and time + 2 days, including seconds These assume the server's zone is US Central time, 6 hours behind UTC in January: [DATETIMEFULLUTC(1/1/2018 3:04:05 PM)] = 1/1/2018 9:04:05 PM [DATETIMEUTC(1/1/2018 3:04:05 PM)] = 1/1/2018 9:04 PM [TIMEUTC(1/1/2018 3:04:05 PM)] = 9:04 PM [DATEUTC(1/1/2018 9:30 PM)] = 1/2/2018 [HOURUTC(1/1/2018 3:04:05 PM)] = 21 [DATETIMEFULLUTC(2)] = Current date and time in UTC + 2 days, including seconds [DATETIMEFULLUTC([DueDate])] = The DueDate field changed to UTC |
|
[DATEADD(Date|Years|Months|Days|Hours|Minutes|Seconds)] [TIMEADD(Date|Years|Months|Days|Hours|Minutes|Seconds)] |
Adds years, months, days, hours, minutes and seconds to Date all at once. Use negative numbers to subtract. You may leave off values at the end, but keep a value (0 if nothing) for each one before the last one you use. Date is required. Unlike [DATE()], a missing Date does not mean today, so send the current date and time in when you need it, as in [DATEADD([DATETIMEFULL]|0|-3)]. The result is the date alone when its time is midnight, otherwise the date and time without seconds. [TIMEADD()] is the same as [DATEADD()] and is kept for older setups. |
[DATEADD(1/1/2018|0|0|4)] = 1/5/2018 [DATEADD(1/1/2018 3:00 PM|1|1|1|1|1|1)] = 2/2/2019 4:01 PM [TIMEADD(1/1/2018 3:00 PM|0|0|0|2)] = 1/1/2018 5:00 PM [DATEADD([DATETIMEFULL]|0|-3)] = Current date and time - 3 months |
|
[DAY] / [DOM] [DAYUTC] / [DOMUTC] New date can be sent in |
Current day of month in server's zone Current day of month in UTC |
[DAY] = 12 [DAY(1/3/2016)] = 3 |
|
[DOW] [DOWUTC] New date can be sent in |
Day of week in server's zone Day of week in UTC Return values are 0 - 6 0 = Sunday 1 = Monday 2 = Tuesday 3 = Wednesday 4 = Thursday 5 = Friday 6 = Saturday |
[DOW] = 3 [DOW()] = 3 [DOW(1/3/2016)] = 0 |
|
[DOY] [DOYUTC] New date can be sent in |
Day of year in server's zone Day of year in UTC |
[DOY] = 73 [DOY(1/3/2016)] = 3 |
|
[HOUR] [HOURUTC] |
Hour of time in 24-hour format in server's zone Hour of time in 24-hour format in UTC |
[HOUR] = 17 (for 5:23:15 PM) [HOUR(1/1/2001 11:23:15 PM)] = 23 |
|
[MINUTE] [MINUTEUTC] |
Minute of time in server's zone Minute of time in UTC * There is no difference between the results of these two commands since UTC only differs in hours to the server time. |
[MINUTE] = 13 (for 5:13:15 PM) [MINUTE(1/1/2001 11:13:15 PM)] = 13 |
|
[SECOND] [SECONDUTC] |
Second of time in server's zone Second of time in UTC * There is no difference between the results of these two commands since UTC only differs in hours to the server time. |
[SECOND] = 15 (for 5:13:15 PM) [SECOND(1/1/2001 11:13:15 PM)] = 15 |
|
[ISDATE(Val|YesVal|NoVal)] |
Checks to see if VAL is a date. If it is a date then the YesVal value is returned. If not then the NoVal is returned. |
[ISDATE(1/1/2018|YEP|NOPE)] = YEP [ISDATE(1/1/2018|1/1/2018|)] = 1/1/2018 [ISDATE(BadDate|YEP|NOPE)] = NOPE |
|
[DIFF(date1|date2|period|StartTime|EndTime|StartDOW|EndDOW)] |
This takes from 3 to 7 parameters Possible date period values: Y = Years as compared by year number [DIFF(1/1/2009|12/31/2009|Y)] = 0 [DIFF(12/31/2009|1/1/2010|Y)] = 1 [DIFF(6/1/2009|5/30/2010|Y)] = 1 [DIFF(6/1/2009|6/1/2010|Y)] = 1 y = Years as compared by # of days [DIFF(1/1/2009|12/31/2009|y)] = 0 [DIFF(12/31/2009|1/1/2010|y)] = 0 [DIFF(6/1/2009|5/30/2010|y)] = 0 [DIFF(6/1/2009|6/1/2010|y)] = 1 M = Months D and d = Days B = Business Days H and h = Hours m = Minutes S and s = Seconds StartHour - The first hour of the day that DIFF should include in 24-hour format. Leave blank to ignore. EndHour - The last hour of the day that DIFF should include in 24-hour format. Leave blank to ignore. This is inclusive so any time that has this as its last hour is included. For instance, if the EndHour was 8 then a time of 8:20 is included because it is in the 8 AM hour. StartDOW - The first day of the week that DIFF should include (0 to 6 where 0=Sunday, 6=Saturday). Leave blank to ignore. EndDOW - The last day of the week that DIFF should include (0 to 6 where 0=Sunday, 6=Saturday). Leave blank to ignore. * To make sure SECONDS works properly, you need to make sure the value you send in has seconds in it. Best to use [DATETIMEFULL] or its UTC counterpart to get the current date/time with seconds. |
[DIFF(1/1/2014|1/4/2017|Y)] = 3 (3 years different) [DIFF(1/1/2017 3:00 AM|1/4/2017 7:00 AM|H|6|16)] = 34 |
|
[FORMAT(date|pattern)] |
Formats value based on its formatting rules according to .NET. Works on numeric and date formats. Date Formats: - Standard - Custom |
Numeric: [FORMAT(12.3|c)] = $12.30 Date: [FORMAT(1/31/2015|yy/dd)] = 15/01 |
|
[CLEANDATE(val|ret)] |
Inspects date and if it is not a date the variable attempts to auto-correct known patterns. If the incoming value is a date then the return is a formatted date - mm/dd/yyyy. Currently corrects the following patterns:
val = value that should be a date. ret = If it cannot auto-correct then this value is returned. |
[CLEANDATE(1/1/2001)] = 1/1/2001 [CLEANDATE(Jan1,2001)] = 1/1/2001 [CLEANDATE(1JAN2001)] = 1/1/2001 [CLEANDATE(Upon Receipt)] = Current Date |
|
[EPOCH()] |
Returns the number of seconds elapsed since 1/1/1970. 1/1/1970 is the considered the beginning of time in UNIX and, as such, this is used in certain security applications. It is used mainly for interactions with external UNIX-style systems. |
[EPOCH()] = 1696953933 |
|
[DATEFROMTERMS(Terms|StartDate)] |
Returns a date that is computed from a terms value. This works with standard Terms values such as NET 30, 2/10 NET 30, COD, In Advance, Immediate, End of Month, 10th Of The Month, etc. Terms = The terms value to be evaluated. StartDate = Date to use for the start of the process such as the Invoice Date. Some calculations need to know that date to compute the Due Date such End of Month. Default is today - i.e. [DATE]. Here is a simple blog on standard invoice terms: https://wise.com/us/blog/invoice-payment-terms |
[DATEFROMTERMS(Net 30|11/21/2023)] = 12/21/2023 [DATEFROMTERMS(Immediate|11/21/2023)] = 11/21/2023 [DATEFROMTERMS(End of Month|11/21/2023)] = 11/30/2023 [DATEFROMTERMS(15th of Month|11/21/2023)] = 12/15/2023 |
|
[DATACHANGED(RecordID|Name)] [DATACHANGEDUTC(RecordID|Name)] |
Return last date/time a data item was changed RecordID - ID of Record for Data element Name - Name of Data Element |
[DATACHANGED(123|LastName)] - 3/1/2024 11:00:00 AM |