SQL DATES
Before insert the DATE value in a table make sure that the format of the DATE in table must be matched with the input DATE in order to insert. Acctually, That is the most difficult part when working with dates.
MySQL & SQL DATE Data Types
- DATE - format YYYY-MM-DD
- DATETIME - format: YYYY-MM-DD HH:MI:SS
- TIMESTAMP - format: YYYY-MM-DD HH:MI:SS
- /SMALLDATETIME - format: YYYY-MM-DD HH:MI:SS
- YEAR - format YYYY or YY
- TIMESTAMP - format: a unique number in SQL SERVER
SQL Date Functions
All the following important Date related functions available through SQL.
- ADDDATE() - Adds Dates
- CURTIME() - Converts from one timezone to another
- CURRENT_DATE()
- DATE_ADD() - Adds a specified time interval to a date
- DATE_SUB() or DATEDIFF() - Subtracts Two Dates
- DATE() - Extracts the date part of a date expression
- DATE_FORMAT() - Specified date/time data in different formats