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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.