DateTime Functions
Supported date_part values are Second, Minute, Hour, Day, Week, Month, Quarter, and Year.
The functions listed in the table below are for SQL queries and should not be used with inline scripts.
The following table lists the datetime functions used in Logi Info:
Function | Description |
---|---|
DATEADD('date_part', interval, datetime) | Returns a datetime value by adding the interval to datetime. The type of interval is determined by date_part. e.g. DATEADD(Month, 4, '1997-04-20T11:30:15') returns '1997-08-20T11:30:15' |
DATEDIFF('date_part', date1, date2) | Returns the difference between date1 and date2 in units of date_part. e.g. DATEDIFF('Month', '1997-04-20T11:30:15', '1997-07-20T11:30:15') returns 3 |
DATENAME('date_part', date) | Returns date_part of the datetime value as a string. e.g. DATENAME('Month', '1997-04-20T11:30:15') returns 'April' |
DAYOFMONTH(date) | Returns the day of the month (number from 1 to 31). e.g. DAYOFMONTH('1997-04-20T11:30:15') returns 20 |
DAYOFWEEK(date) | Returns the weekday index of the date (1 = Sunday, 2 = Monday, ..., 7 = Saturday). e.g. DAYOFWEEK('1997-04-20T11:30:15') returns 1 |
DAYOFYEAR(date) | Returns the day of the year (number from 1 to 366). e.g. DAYOFYEAR('1997-04-20T11:30:15') returns 110 |
DATEPART('date_part', date) | Returns date_part of the datetime value as an integer. e.g. DATEPART('Day', '1997-04-20T11:30:15') returns 20 |
NOW() | Returns the current date and time. Does not accept arguments. |
TO_DATE(datetime) | Returns the date part of datetime value. e.g. TO_DATE([OrderDate]) returns the date without the time component. |
TODAY() | Supported temporal values are Second, Minute, Hour, Day, Week, Month, Quarter, and Year. |