displaying date submitted

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

displaying date submitted

Post 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"));
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

looks more like he's reinventing getdate()
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Post 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
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Post 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);
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

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