Jump to content

How do I convert date and time to int(10) format from YYYY-MM-DD HH:MM?


Dave_77

Recommended Posts

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

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.