Author |
Message |
Donovan
Client
Joined: Oct 07, 2003
Posts: 735
Location: Ohio
|
Posted:
Tue Dec 12, 2006 8:28 pm |
|
This is stored in the db as varchar and is ten digits. I assume this is a timestamp and I'm trying to extract it and format for display.
The only thing I've gotten to display is Dec 30, 1969.
I can't figure this out and I've been researching it for an hour.
Code:$sql = $db->sql_query("SELECT game_id, winner, loser, date, winnerscores, loserscores FROM " . $prefix . "_tc_playedgames tcp
JOIN " . $prefix . "_tc_ladders tcl
WHERE tcp.ladder_id = tcl.sid
AND tcl.active = '1'");
while ( $row = $db->sql_fetchrow($sql) ) {
$game_id = $row['game_id'];
$winner = $row['winner'];
$loser = $row['loser'];
$date = $row['date'];
list($Year,$Month,$Day) = split('-',$date);
$matchdate = date("M j, Y",mktime(12,0,0,$Month,$Day,$Year));
$winnerscores = $row['winnerscores'];
$loserscores = $row['loserscores'];
|
Ideally I need to display something like Dec 11, 2006 9:28AM |
|
|
|
|
evaders99
Former Moderator in Good Standing
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Tue Dec 12, 2006 9:14 pm |
|
|
|
|
Donovan
|
Posted:
Tue Dec 12, 2006 10:03 pm |
|
Nope.
Now it says -1 for all the dates.
Code:$sql = $db->sql_query("SELECT game_id, winner, loser, date, winnerscores, loserscores FROM " . $prefix . "_tc_playedgames tcp
JOIN " . $prefix . "_tc_ladders tcl
WHERE tcp.ladder_id = tcl.sid
AND tcl.active = '1'");
while ( $row = $db->sql_fetchrow($sql) ) {
$game_id = $row['game_id'];
$winner = $row['winner'];
$loser = $row['loser'];
$date = $row['date'];
$matchdate = strtotime('F j, Y, g:i a',$date);
$winnerscores = $row['winnerscores'];
$loserscores = $row['loserscores'];
echo"<tr>"
. "<td align=\"center\" bgcolor=\"#666666\"><font color=\"#000000\">$matchdate</td>"
|
|
|
|
|
|
djmaze
Subject Matter Expert
Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv
|
Posted:
Wed Dec 13, 2006 7:41 am |
|
what does the field 'date' contain?
Without knowing what it has you're screwed |
_________________ $ mount /dev/spoon /eat/fun auto,overclock 0 1
ERROR: there is no spoon
[ Only registered users can see links on this board! Get registered or login! ] |
|
|
|
Donovan
|
Posted:
Wed Dec 13, 2006 8:03 am |
|
varchar (40)
The field has this as a value
1165318740 |
|
|
|
|
Gremmie
Former Moderator in Good Standing
Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Wed Dec 13, 2006 8:38 am |
|
If that is a unix timestamp, then its about 2006'ish. Does that sound right?
Use the date() function on it and see.
[ Only registered users can see links on this board! Get registered or login! ]
$prettyDate = date('F j, Y, g:i a', $date); |
_________________ GCalendar - An Event Calendar for PHP-Nuke
Member_Map - A Google Maps Nuke Module |
|
|
|
Donovan
|
Posted:
Wed Dec 13, 2006 2:05 pm |
|
|
|
|
|