The date format stored in the database is different from the date format in SQL.
SQL> insert into test_date values (to_date ('2017-12-17 16:42:42 ', 'syyyy-mm-dd hh24: mi: ss '));
One row has been created.
SQL> select to_char (date_col, 'syyyy-mm-dd hh24: mi: ss') dat, dump (date_col) dump_date from test_date;
DAT DUMP_DATE
-----------------------------------------------------------------------------
16:42:42 Typ = 12 Len = 7: 120,104, 43
SQL> select to_char (to_date ('2017-12-17 16:42:42 ', 'syyyy-mm-dd hh24: mi: ss'), 'syyyy-mm-dd hh24: mi: ss') dat,
2 dump (to_date ('2017-12-17 16:42:42 ', 'syyyy-mm-dd hh24: mi: ss') dump_date from dual;
DAT DUMP_DATE
-----------------------------------------------------------------------------
16:42:42 Typ = 13 Len = 8: 212,7, 12,17, 16,42, 0
The results are quite different! So the storage methods are different!
The storage difference between the two is: 1) century, 2) hour, minute, and second
The dates in SQL are stored in numeric values. For example: 212 + 7*256 = 2004
SQL> select to_char (to_date ('-2004-12-17 16:42:42', 'syyyy-mm-dd hh24: mi: ss'), 'syyyy-mm-dd hh24: mi: ss ') dat,
2 dump (to_date ('-2004-12-17 16:42:42', 'syyyy-mm-dd hh24: mi: ss') dump_date from dual;
DAT DUMP_DATE
-----------------------------------------------------------------------
-16:42:42 Typ = 13 Len = 8: 44,248
In SQL, the maximum value of the first digit of a date is 256, and the maximum value of the second digit is 255. In addition, BC is complementary to that of the second digit.