- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
The Date function (DATE) generates a Unix timestamp from the Year, Month, Day, and Timezone provided at 12:00 AM.
The Date function has four parameters, three of which is required:
Allowed Inputs: field value or number
The first required parameter is the number that represents the year. The year should be completely written out “97” will be interpreted literally and is not a short form of 1997. Either use the use the Query Builder to choose a field that contains the value or use type a value to enter a number.
Allowed Inputs: field value or a number
The second parameter of the Date function is the number that represents the month. Either use the query builder to choose a field that contains the value or use type a value to enter a number. Only numeric representations of the month are accepted “January” is an invalid input. If a value provided is greater than 12 or less than 0 then the month and the year will be changed to accommodate that value for example if the month value is 13 and the year is 2012 then it will be treated as the month 1 and the year 2013.
Allowed Inputs: field value or a number
The third parameter of the Date function is the number that represents the day of the month. Either use the query builder to choose a field that contains the value or use type a value to enter a number. If a value provided is outside the range for the month provided then the month and the day will be changed to accommodate that value for example if the month value is 9 and the day is 32 then it will be treated as the month 10 and the day 2.
Allowed Inputs: field value or a text string
The fourth parameter of the Date function is a string that represents the timezone. Either use the query builder to choose a field that contains the value or use type a value to enter a number. The value should be based on the tz (timezone) database used by Linux and other Unix system in the form “Area/Location” e.g. “America/New_York”. If no value is provided then the current user's timezone is used.
The output of the Date function is number representing the Unix timestamp for the values given.
For example DATE(2012,10,2,“America/New_York”) would result in 1349150400.