MYSQL date function: TO_DAYS() and FROM_DAYS()

2019-09-1120:23:01 Comment

1、to_days(date), change the date to a integer number days.

mysql> SELECT TO_DAYS(950501); -> 728779 
mysql> SELECT TO_DAYS('1997-10-07'); -> 729669

2、from_days(number), change the integer number days to a date.

mysql> SELECT FROM_DAYS(729669); -> '1997-10-07'

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: