Expressions - Date and Time

Overview
This page describes the format of expressions grouped by date and time. These can be used within various section of Linworks such as imports, exports and template designer.

ExpressionFormatDescription
Date Add dateadd[date, "type", amount] Where date is a valid date, and type is "y", "m", "d" or "b" (representing year, month, day, or business days) and amount is an integer. Adds an amount to a date. Please note that the amount may be negative
Day day[d1] Where d1 is a date value. Returns the day of a date
Day Of Week dayofweek[a] Returns a day string. For example dayofweek[today[]] returns Wednesday.
Note: dayofweek[now[]] will not work. Use dayofweek[nowf[]] instead
Hour Hour[a] Returns numeric value. For example hour[nowf[] returns 12
Maximum datemax[d1, ..., dn] Where d1, ..., dn are dates. Returns the maximum date in the list
Minimum datemin[d1, ..., dn] Where d1, ..., dn are dates. Returns the maximum date in the list
Month month[d1] Where d1 is a date value. Returns the month of a date
New Date date[m, d, y] Where m is an integer and is the month, d is an integer and is the day, and y is an integer and is the year. Create a new date data type
Now now[] This operand function takes no parameters. Returns the current date
Now Formatted Nowf[] Does not take any parameters. Returns current time. For example NowF[] returns 2013-06-12 12:42:22
Now Format Date nowfd[a] Returns current time. For example:
Nowfd[""] returns 21/06/2013 12:42:22 (default format)
nowfd["ddd, dd MMM yyyy HH:mm:ss zzzz"] returns Fri, 21 Jun 2013 16:55:50 +01:00 (RFC 2822 format)
nowfd["dddd, dd MMM yyyy HH:mm:ss zzzz"] returns Friday, 21 Jun 2013 16:55:50 +01:00
For more info please visit: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
ParseDateTime ParseDateTime[date, inputformat , outputformat] Returns a given the date in the outputformat specified.
ParseDateTime["2013-08-18","yyyy-MM-dd","MMM dd yyyy"] returns Aug 18 2013
ParseDateTime["8/18/2013","M/d/yyyy","d/M/yyyy HH:mm:ss"] returns 18/8/2013 00:00:00
The inputformat needs to match the date/time format on your machine. To retrieve the current format of your dates, e.g. the dReceievedDate, use EVAL{BEGIN}[v{dReceievedDate}]{END}
Example: ParseDateTime[v{dReceievedDate}, "dd/MM/yyyy HH:mm:ss", "dd MM yyyy"] returns 18 08 2013
Today Today[] Does not take any parameters.
Returns today's date. For example Today[] returns 2013-06-12
Year year[d1] Where d1 is a date. Returns the year of a date

Additional Types