1: SQL Server date type:
For 'yyyy-MM-DD hh: mm: SS
2. MySQL Date and Time type:
Date. The supported range is '2017-01-01 'to '2017-12-31 '. MySQL displays the date value in 'yyyy-MM-DD 'format
Datetime, a combination of date and time. Supported range: '2017-01-01
00:00:00 'to '2017-12-31 23:59:59 '. MySQL with 'yyyy-MM-DD
Display the datetime value in HH: mm: ss' format
Timestamp [(M)], Timestamp. The returned timestamp value is 'yyyy-MM-DD
Hh: mm: ss' Format String. The display width is fixed to 19 characters.
Time, time. The value range is '-838: 59: 59' to '2014: 59: 59 '. MySQL displays the time value in the format of 'hh: mm: ss '.
Year [(2 | 4)], two or four-digit year. The default format is four bits. In the four-digit format, the allowed values are 1901 to 2155 and 0000. In the two-digit format, the allowed values are 70 to 69, indicating that the value ranges from January 1, 1970 to January 1, 2069. MySQL displays the Year Value in yyyy format
3:The default date and time format of Java is
Thu Jul 07 17:05:39 CST 2005
To convert the format to, use the simpledateformat class.
Simpledateformat formatt = new simpledateformat ("yyyy-mm-dd ");
Date = new date ();
System. Out. println (formatt. Format (date ));
The printed format is:
Simpledateformat formatt = new simpledateformat ("yyyy-Mmmm-dd ");
Date = new date ();
System. Out. println (formatt. Format (date ));
The printed format is: 2005-July-07
---------------------------
4: default date format of Oracle
SQL> select sysdate from dual;
Sysdate
----------
Month 7-05
Convert to_char to yyyy-mm-dd format
SQL> select to_char (sysdate, 'yyyy-mm-dd') time from dual;
Time
----------
2005-07-07
There are two date-related functions in Oracle: to_date () and to_char ();
To_date () converts the character type to the date type in a certain format:
Specific usage: to_date ('1970-11-27 ', 'yyyy-mm-dd'). The former is a string, and the latter is a conversion date format. Note that the first and second data must be in the correct format.
For example, to_date ('2017-11-27 13:34:43 ', 'yyyy-mm-dd hh24: MI: ss') will get the specific time
To_date () converts the character type to the date type in a certain format:
Specific usage: to_date ('1970-11-27 ', 'yyyy-mm-dd'). The former is a string, and the latter is a conversion date format. Note that the first and second data must be in the correct format.
For example, to_date ('2017-11-27 13:34:43 ', 'yyyy-mm-dd hh24: MI: ss') will get the specific time.