TecTao Posted March 24, 2009 Share Posted March 24, 2009 I've been trying, researching and writing different snippets for 2 days to try and get a unix timestamp converted to a date/time. Here is the select statement $q = "SELECT fname,email,timestamp " ."FROM ".TBL_USERS." ORDER BY userlevel DESC,fname"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); Here is the for($i=0; $i<$num_rows; $i++){ $fname = mysql_result($result,$i,"fname"); $email = mysql_result($result,$i,"email"); $time = mysql_result($result,$i,"timestamp"); I have tried using a convert timestamp function, I've tried converting in the select statememt. I most be missing something here, any ideas[/] Quote Link to comment Share on other sites More sharing options...
jdaum Posted April 8, 2009 Share Posted April 8, 2009 Hi, I was just researching the mysql method to do this when I came across this post. MySQL method: selectfname, email, from_unixtime(timestamp) from your_table From: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html PHP method: print date("Y-m-d h:i:s", $time); HTH, Jochen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.