zrweber Posted January 13, 2011 Share Posted January 13, 2011 Alright, I have a Datetime field in my database which I'm trying to store information in. Here is my code to get my Datetime, however it's returning to me the wrong date. It's returning: 1969-12-31 19:00:00 $mysqldate = date( 'Y-m-d H:i:s', $phpdate ); $phpdate = strtotime( $mysqldate ); echo $mysqldate; Is there something wrong with it? Link to comment https://forums.phpfreaks.com/topic/224282-datetime-my-code-is-returning-the-wrong-datemysqldate-date-y-m-d-his/ Share on other sites More sharing options...
revraz Posted January 13, 2011 Share Posted January 13, 2011 What does the date look like in the table itself? Looks like it's returning 0. Also, how are you getting $phpdate? Link to comment https://forums.phpfreaks.com/topic/224282-datetime-my-code-is-returning-the-wrong-datemysqldate-date-y-m-d-his/#findComment-1158793 Share on other sites More sharing options...
dragon_sa Posted January 13, 2011 Share Posted January 13, 2011 what is the original value of $phpdate when you first use it, thats where its taking the time and date from try and echo $phpdate first and see what you get Link to comment https://forums.phpfreaks.com/topic/224282-datetime-my-code-is-returning-the-wrong-datemysqldate-date-y-m-d-his/#findComment-1158794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.