Web Hosting Talk







View Full Version : Phpbb Help! IMPORTANT


ensol
09-11-2004, 08:52 AM
Hey, I am hoping someone can figure this out for me

I am trying to figure out how phpbb forums store time with my sql

For example:

someone posts a topic on Tue Jun 15, 2004 3:14 am



The mysql database stores the date as 1087269273

Can someone figure out how this formula works? Thanks

Burhan
09-11-2004, 09:20 AM
This called a unix timestamp, which is the number of seconds from January 1 1970 (called the Unix Epoch).

You can take this number and calculate the current date using a number of date and time functions (both in PHP and in MySQL).

For example, to find out what date a given timestamp is, the following code works (PHP):


<?php
echo date("r",1087269273);
?>

More information at http://www.php.net/date

ensol
09-11-2004, 09:40 AM
you totally rock, thanks! but why since jan 1 1970?

PaddysPlace
09-11-2004, 10:05 AM
Ensol,

January 1, 1970 was actually a fairly random date for them to choose. I guess they felt if the date stores was before then, it wouldn't be in a database data record (timestamp) but rather just written as a full date. Just my thoughts.

Regards,
Patrick

ensol
09-11-2004, 01:55 PM
interesting