Days Since 1 A.D. : Introduction : Date Time Functions MySQL TUTORIALS


MySQL TUTORIALS » Date Time Functions » Introduction »

 

Days Since 1 A.D.


TO_DAYS(date) returns the number of days since the first day in the year 1 A.D. (there was no year 0).

The opposite effect is obtained by using FROM_DAYS(number).

mysql>
mysql> select TO_DAYS('2000-01-01') ;
+-----------------------+
| TO_DAYS('2000-01-01') |
+-----------------------+
|                730485 |
+-----------------------+
row in set (0.00 sec)

mysql>
mysql>
mysql> SELECT FROM_DAYS(1000000);
+--------------------+
| FROM_DAYS(1000000|
+--------------------+
2737-11-28         |
+--------------------+
row in set (0.02 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Date Time Functions
» Introduction