datetime - SQL: How to convert future date to timestamp with UNIX_TIMESTAMP()? -


i want convert datetime column unix timestamp. thing dates in distant future, such 2066-09-01... can try simple queries:

select unix_timestamp( '2016-09-03 09:00:00' ) returns 1472886000 -> good

select unix_timestamp( '2036-09-03 09:00:00' ) returns 2104038000 -> good

select unix_timestamp( '2066-09-03 09:00:00' ) returns 0 -> bad! why??

any idea? workaround ?

sounds rdbms suffering y2038 problem: https://en.m.wikipedia.org/wiki/year_2038_problem

is mysql? have bug this: https://dev.mysql.com/worklog/task/?id=1872

suggest handling outside sql if possible. php's strtotime() , similar functions in other languages can play nice mysql's iso date format.


Comments