owner Posted March 8, 2010 Share Posted March 8, 2010 Hello, I am working on a calendar application. I was wondering what the best wayto store dates for it would be. Is there even a way to have mySQL select a date in the form of the unix timestamp where the month = x or the day = x? I have always just stored them using a unix timestamp with the time() function from php. Any suggestions would be greatly appreciated. Thanks! owner Quote Link to comment https://forums.phpfreaks.com/topic/194464-storing-dates/ Share on other sites More sharing options...
PravinS Posted March 8, 2010 Share Posted March 8, 2010 You can use DATETIME data type. Quote Link to comment https://forums.phpfreaks.com/topic/194464-storing-dates/#findComment-1022881 Share on other sites More sharing options...
straylight Posted March 8, 2010 Share Posted March 8, 2010 You are better off with MySQL's DATETIME format, because MySQL's date functions don't work on unix timestamps. Quote Link to comment https://forums.phpfreaks.com/topic/194464-storing-dates/#findComment-1022951 Share on other sites More sharing options...
PravinS Posted March 8, 2010 Share Posted March 8, 2010 Run below given query in MySQL SELECT UNIX_TIMESTAMP(CURDATE()); Quote Link to comment https://forums.phpfreaks.com/topic/194464-storing-dates/#findComment-1022952 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.