PDA

View Full Version : Date Stamp Converter


jamesglewisf
Sat 17th Feb '01, 2:17pm
I don't know if this is a MySQL or PHP question.

When I query my database, I notice that the dates are stored in a funky format that I don't recognize. Is there some kind of formula I can use (with my calculator) for translating back and forth from the date stamp to an actual date/time? I'm not talking about a PHP function, but a formula I can use.

For instance, how do you turn 968739029 into a real date?

Mas*Mind
Sat 17th Feb '01, 5:43pm
http://www.php.net/manual/function.date.php

But I strongly suggest you to leave the format in the db as it is...It's much better to convert them on the fly. The format that's in your database is called a timestamp and represents the number of seconds since 'some date in 1970' if I'm right...

Freddie Bingham
Sat 17th Feb '01, 5:44pm
Jan 1, 1970.

jamesglewisf
Sun 18th Feb '01, 11:29am
I wasn't going to change the format. I wanted to know how to create the number so that I could do an SQL query based upon dates. I'm guessing that isn't possible.

Chris Schreiber
Tue 20th Feb '01, 12:51pm
Actually take your date/time and convert it to Epoch time (the Unix time from Jan 1 1970) that vB uses. Look at the PHP strtotime function, like strtotime("5-11-2001 5:41 PM") will give you the Epoch time.