Andy11548 Posted September 5, 2012 Share Posted September 5, 2012 Hello, In the database I have a field named "topic_time", but the value is 1346880835. How do I display that in D/M/Y format? Thanks, Andy Quote Link to comment https://forums.phpfreaks.com/topic/268041-datestimes/ Share on other sites More sharing options...
The Little Guy Posted September 5, 2012 Share Posted September 5, 2012 First off, don't save dates as unix timestamps. Quote Link to comment https://forums.phpfreaks.com/topic/268041-datestimes/#findComment-1375598 Share on other sites More sharing options...
Adam Posted September 5, 2012 Share Posted September 5, 2012 That's a Unix timestamp. Check out the second parameter for date. Quote Link to comment https://forums.phpfreaks.com/topic/268041-datestimes/#findComment-1375599 Share on other sites More sharing options...
Andy11548 Posted September 5, 2012 Author Share Posted September 5, 2012 First off, don't save dates as unix timestamps. First of all, I cba editing PHPBB's code. Don't post useless shit. Quote Link to comment https://forums.phpfreaks.com/topic/268041-datestimes/#findComment-1375601 Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2012 Share Posted September 5, 2012 What do you expect when you ask a question that begs an answer like that? You never said it was phpbb's code, so it's perfectly reasonable to propose storing the data properly to begin with. Now, to address your question with the additional necessary tidbit that you can't/won't alter the code that handles the insert, there are the MySQL functions DATE_FORMAT() and FROM_UNIXTIME() that will allow you to do what you want. Quote Link to comment https://forums.phpfreaks.com/topic/268041-datestimes/#findComment-1375610 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.