Date Time (Expression Function)

Purpose

The Date Time function (DATETIME) generates a Unix timestamp from the Year, Month, Day, Hours (24-Hour), Minutes, Seconds, and Timezone provided.

Parameters

The Date Time function has four parameters, three of which is required:

Year

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.

Month

Allowed Inputs: field value or a number

The second parameter of the Date Time 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.

Day

Allowed Inputs: field value or a number

The third parameter of the Date Time 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.

Hours

Allowed Inputs: field value or a number

The fourth parameter of the Date Time function is the number that represents the hour of the day. 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 greater than 24 or less than 0 then the day and hours will be changed to accommodate that value for example if the day value is 5 and the hour is 32 then it will be treated as the day 6 and the hour 8.

Minutes

Allowed Inputs: field value or a number

The fifth parameter of the Date Time function is the number that represents the minute of the hour. 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 greater than 60 or less than 0 then the hours and minutes will be changed to accommodate that value for example if the hour value is 12 and the minute is 72 then it will be treated as the hour 13 and the minute 12.

Seconds

Allowed Inputs: field value or a number

The sixth parameter of the Date Time function is the number that represents the seconds of the mintue. 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 greater than 60 or less than 0 then the minutes and seconds will be changed to accommodate that value for example if the minute value is 18 and the seconds value is 88 then it will be treated as the minute 19 and the second 28.

Timezone

Allowed Inputs: field value or a text string

The seventh parameter of the Date Time 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.

Output

The output of the Date Time function is number representing the Unix timestamp for the values given.

Example

For example DATE(2012,10,1,20,29,11,“America/New_York”) would result in 1349137751.

expression function - date and time.txt · Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2024