Page 1 of 1

displaying date submitted

Posted: Mon Nov 20, 2006 1:00 am
by 4Boredom
Anyone know why this displays nothing?

Code: Select all

function TimestampToDatetime($Tstamp) {
    $dt[0] = substr($Tstamp,0,4);
    $dt[1] = substr($Tstamp,4,2);
    $dt[2] = substr($Tstamp,6,2);
    $tm[0] = substr($Tstamp,8,2);
    $tm[1] = substr($Tstamp,10,2);
    $tm[2] = substr($Tstamp,12,2);
    return (join($dt,"-") . " " . join($tm,":"));
} 
print(TimestampToDatetime("1164002814"));

Posted: Mon Nov 20, 2006 1:19 am
by timvw
It seems you have mixed up the order of the arguments...
string implode ( string glue, array pieces )
Anyway, it seems as if you're re-inventing date.

Posted: Mon Nov 20, 2006 1:24 am
by Luke
looks more like he's reinventing getdate()

Posted: Mon Nov 20, 2006 1:44 am
by 4Boredom
ill work with both of those lol.. well i have been for 20 min... just no luck.. ill post back if im still stuck

Posted: Mon Nov 20, 2006 2:02 am
by 4Boredom
This is the closest I can get without breaking the computer :)

If anyone can help itd be appreciated...

This says I have a t-string error?

I got these thoughts from the date() function

Code: Select all

$s = string date ( string m d y[, int 1163986609] );
echo($s);

Posted: Mon Nov 20, 2006 4:02 am
by timvw

Code: Select all

$s = date("m-d-y", 1163986609);
echo $s;