chaking Posted December 11, 2009 Share Posted December 11, 2009 Is it possible to select a datetime field as a unix timestamp? I was selecting the string and then converting with `strtotime` but that leaves off the seconds, so if there's a built in function that would be great - Quote Link to comment https://forums.phpfreaks.com/topic/184826-select-datetime-as-unx-timestamp/ Share on other sites More sharing options...
chaking Posted December 12, 2009 Author Share Posted December 12, 2009 The answer would be: SELECT stamp = DATEDIFF(s, '19700101', column) FROM EVENTS WHERE column > 'xxx' Quote Link to comment https://forums.phpfreaks.com/topic/184826-select-datetime-as-unx-timestamp/#findComment-975742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.