PDA

View Full Version : Dateline says it's 1969..


r_sole
01-19-2008, 01:55 AM
Okay, I want to get the date of when a certain thread was created.

I'm doing this:

// Get latest thread details
require("../dbinfo.php");
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("MYSITE_forum");
$result = mysql_query("SELECT * FROM vbulletin_thread WHERE forumid=4 ORDER BY threadid DESC LIMIT 1");
$threadinfo = mysql_fetch_assoc($result);

//Check date thread
$dateline = $threadinfo['dateline'];
$threadinfo_date = date('m-d-Y', $dateline);


Well I did that and echo'd $threadinfo_date and I got:
12-31-1969

I really doubt the thread was made then.

So what the hell, how do I get the actual date? Thanks :up:

Opserty
01-19-2008, 09:19 AM
Run this above "Check date thread":

var_dump($threadinfo['dateline']);
//Check date thread

Whats the output? Also check that the other data is being returned such as the title and posting user. Finally you should order by dateline if you want the most recent thread as opposed to threadid, it just makes more sense.

r_sole
01-19-2008, 11:04 AM
you should order by dateline if you want the most recent thread as opposed to threadid, it just makes more sense.
Good point.

By the way, I figured out what the problem was. The forum I was looking in had no threads in it, so since php found no timestamp it probably just reverted back to 1969 (for some reason...I think it could be the 'default' or something like that).

Opserty
01-19-2008, 11:11 AM
Unix time, or POSIX time, is a system for describing points in time: it is the number of seconds elapsed since midnight UTC of January 1, 1970, not counting leap seconds.


So if it was set to zero (as it had found no timestamp) it would be the second before taking 01/01/1970 as 1. But you don't really need to worry about all that ;)