July 29th, 2003, 06:05 PM
Join Date: Jul 2003
Time spent in forums: 2 h 1 m 55 sec
Reputation Power: 11
Problem with "timestamp"
I want to display a timestamp showing when a record was submitted to the database. I had originally written it in MySQL, but I have to transsition to PostgreSQL and I am wondering how I can convert the following code to PostgreSQL compatible code:
$datefromdb = $row['time'];
$year = substr($datefromdb,0,4);
$mon = substr($datefromdb,4,2);
$day = substr($datefromdb,6,2);
$hour = substr($datefromdb,8,2);
$min = substr($datefromdb,10,2);
$sec = substr($datefromdb,12,2);
$orgdate = date("l F d, Y h:i A",mktime($hour,$min,$sec,$mon,$day,$year));
I currently have a "timestamp(13) with time zone" column in my database to store the date and time a record is submitted. When I run my script with this code I don't get any errors or anything, except I get bizare dates like "Wednesday December 31, 1969 03:59 PM"
. Can someone please help me figure out what is wrong? Thanks.