hi, im using a users database for my site which uses a timestamp to tell when a user was last logged in. is there any way i could convert this timestamp into 12/24hr clock time? eg. convert 1268823208 into say 10.30am? thanx in advance!
hi, im using a users database for my site which uses a timestamp to tell when a user was last logged in. is there any way i could convert this timestamp into 12/24hr clock time? eg. convert 1268823208 into say 10.30am? thanx in advance!
Last edited by liamallan; 03-17-2010 at 05:57 PM.
Gives : 10.53amPHP Code:<?php
$timestamp = 1268823208;
echo date('h.ia', $timestamp);
?>
liamallan (03-17-2010)
thanx mate, after a little tweaking to fit in with login script, this is how it looks
is there any way i could display the date they were last active as well? eg DD/MM/YYYY. thanx again!PHP Code:$timestamp = $req_user_info['timestamp'];
echo "<b>Last Active: ".date('h.ia', $timestamp)." </b><br><br>";
Last Active: 17/03/2010 at 10.53amPHP Code:$timestamp = $req_user_info['timestamp'];
echo "<b>Last Active: ".date('d/m/Y \a\\t h.ia', $timestamp)." </b><br><br>";
liamallan (03-17-2010)
Cheers mate, works flawlessly!! thanks for ur time and knowledge!!
No probs, if you need more info on the date function just look here: http://uk.php.net/manual/en/function.date.php
liamallan (03-17-2010)
Bookmarks