Timestamp ...

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
stevoo
Forum Newbie
Posts: 9
Joined: Tue Aug 26, 2008 3:58 pm

Timestamp ...

Post by stevoo »

Me again :)

So i get a timestamp from my psql database and it is returned like this
2008-08-28 23:12:25.275871

Now i try to truncate it with php like this

Code: Select all

while($row = pg_fetch_array($result)){
        $tomorrow = mktime($row['newtime']);
        echo $row['newtime']; 
        echo " - ".date("y/m/d", $tomorrow);
but it will not give me the correct results ...
it will instead return me this

2008-08-28 23:12:25.275871 - 08/11/19
2008-08-28 20:45:04.281969 - 08/11/19
2008-08-28 18:57:55.362821 - 08/11/19
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Timestamp ...

Post by jayshields »

Have you read about mktime() in the manual?
Post Reply