SQL Date Functions

SQL date functions allow you to manipulate date and time data effectively. You can use the date functions for various operations such as adding days to a date, calculating the difference between two dates, or getting parts of a date.

NameDescription
CURRENT_DATEReturn the current date
CURRENT_TIMEReturn the current time
CURRENT_TIMESTAMPReturn the current date and time
Convert date to stringUse the CAST() or TO_CHAR() function to convert a date to a string
Convert string to dateUse the CAST() or TO_DATE() function to convert a string to a date based on a specified format
DATEADDAdd an interval to a date
DATEDIFFFind the difference between two dates
DATEPARTExtract a part of a date such as a year, month, and day from a given date
Extract Year from DateExtract the year from a date
Extract Month from DateExtract the month from a date
Extract Day from DateExtract the day of the month from a date