Wednesday, March 17, 2010

Is MySQL support Julian Dates?


I use it in Oracle and notice there are 10 days missed, for example:

ORCL> select to_date('4/10/1582','dd/mm/yyyy') SHOW_DATE from dual

SHOW_DATE
--------------
04/10/1582

ORCL> select to_date('4/10/1582','dd/mm/yyyy') + 1 SHOW_DATE from dual

SHOW_DATE
--------------
15/10/1582

Say What? the date after 4/10/1582 is 15/10/1582.

But in MySQL i try it but i didn't see this case, example:


mysql> select adddate('1582-10-04', interval 0 day);
+---------------------------------------+
| adddate('1582-10-04', interval 0 day) |
+---------------------------------------+
| 1582-10-04                            |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> select adddate('1582-10-04', interval 1 day);
+---------------------------------------+
| adddate('1582-10-04', interval 1 day) |
+---------------------------------------+
| 1582-10-05                            |
+---------------------------------------+
1 row in set (0.00 sec)

Ohhh its not like Oracle!!!


So Why? Is MySQL support Julian dates?

1 comment:

  1. MySQL uses the proleptic calendar:
    http://dev.mysql.com/doc/refman/5.1/en/mysql-calendar.html

    ReplyDelete