Dave_77 Posted March 17, 2008 Share Posted March 17, 2008 Hello, This is probably a strange question, but here goes: I have a MySQL database that stores date and time as int(10). I am just checking a few entries in the database - the one that has datetime of 2008-03-16 22:10 is represented as 1205791837 in the MySQL database as int(10), for example. I would need to rebuild the chronology of certain database entries, however, I do not know their date/times as int(10)'s, I know them as dates and times. So, here goes - is there an online utility/converter where I can enter, for example, "2008-01-15 19:00" and get the equivalent in int(10) representation? This would be massive help. P.S. Could I do it in phpMyAdmin using some SELECT CONVERT ('2008-01-15 19:00'...) function? I would be surprised if I couldn't, but I don't know the syntax. Cheers Quote Link to comment Share on other sites More sharing options...
corbin Posted March 18, 2008 Share Posted March 18, 2008 PHP function strtotime(). http://php.net/strtotime I've forgotten how to do it in MySQL x.x. Quote Link to comment Share on other sites More sharing options...
ikmyer Posted March 18, 2008 Share Posted March 18, 2008 can you pull them from the db and then do... <?php ... echo strtotime($row['time']); ... ?> Quote Link to comment Share on other sites More sharing options...
corbin Posted March 18, 2008 Share Posted March 18, 2008 Ahhhh some light googling gave the MySQL way.... mysql> SELECT UNIX_TIMESTAMP('2008-03-17 19:13:56'); +---------------------------------------+ | UNIX_TIMESTAMP('2008-03-17 19:13:56') | +---------------------------------------+ | 1205799236 | +---------------------------------------+ 1 row in set (0.02 sec) Quote Link to comment 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.