steveangelis Posted April 25, 2009 Share Posted April 25, 2009 I havelook around but not found what I need. I am tryingto do something simple and it will not work for me correctly: mysql_query("insert into test SET test = UNIX_TIMESTAMP(NOW())"); $result=mysql_query("SELECT UNIX_TIMESTAMP(test) AS FORMATED_TIME FROM test"); $FORMATED_TIME=mysql_result($result,0,"FORMATED_TIME"); $date=date("H:i:sa",$FORMATED_TIME); echo "$date"; What this SHOULD do is insert the current date/time into the database and retreive it to show it but I am getting this: 16:00:00pm What am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/155650-unix/ Share on other sites More sharing options...
Mchl Posted April 25, 2009 Share Posted April 25, 2009 What datatype is test column? Link to comment https://forums.phpfreaks.com/topic/155650-unix/#findComment-819220 Share on other sites More sharing options...
steveangelis Posted April 25, 2009 Author Share Posted April 25, 2009 varchar(50) Link to comment https://forums.phpfreaks.com/topic/155650-unix/#findComment-819224 Share on other sites More sharing options...
Mchl Posted April 25, 2009 Share Posted April 25, 2009 You should use DATETIME or TIMESTAMP instead. Here's something that may interest you http://www.phpfreaks.com/blog/too-much-information-about-the-mysql-timestamp Link to comment https://forums.phpfreaks.com/topic/155650-unix/#findComment-819225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.