Open Group CLI Time and Date Functions

From Apache OpenOffice Wiki
Jump to: navigation, search



Time and Date Functions Function Returns
CURDATE() The current date as a date value.
CURTIME() The current local time as a time value.
DAYNAME(date) A character string representing the day component of the date. The name for the day is specific to the data source.
DAYOFMONTH(date) An integer from 1 to 31 representing the day of the month in date.
DAYOFWEEK(date) An integer from 1 to 7 representing the day of the week in date, where 1 represents Sunday.
DAYOFYEAR(date) An integer from 1 to 366 representing the day of the year in date.
HOUR(time) An integer from 0 to 23 representing the hour component of time.
MINUTE(time) An integer from 0 to 59 representing the minute component of time.
MONTH(date) An integer from 1 to 12 representing the month component of date.
MONTHNAME(date) A character string representing the month component of date. The name for the month is specific to the data source.
NOW() A timestamp value representing the current date and time.
QUARTER(date) An integer from 1 to 4 representing the quarter in date, where 1 represents January 1 through March 31.
SECOND(time) An integer from 0 to 59 representing the second component of time.
TIMESTAMPADD(interval, count, timestamp) A timestamp calculated by adding count interval(s) to timestamp. Interval may be one of the following: SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, or SQL_TSI_YEAR.
TIMESTAMPDIFF(interval, timestamp1, timestamp2) An integer representing the number of interval(s) by which timestamp2 is greater than timestamp1. Interval may be one of the following: SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, or SQL_TSI_YEAR
WEEK(date) An integer from 1 to 53 representing the week of the year in date.
YEAR(date) An integer representing the year component of date.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages