s_ainley87 Posted January 12, 2009 Share Posted January 12, 2009 How can i insert the current datetime in my msql table using php, I ahve tried assing a variable like this $date = date("Y M D"); and send that but that does not work all i get is the default 0000-00-00 00:00:00. Any help out there? Thanks Link to comment https://forums.phpfreaks.com/topic/140516-send-current-date-and-time-to-mysql-datetime-field/ Share on other sites More sharing options...
revraz Posted January 12, 2009 Share Posted January 12, 2009 Just use the MySQL NOW() Link to comment https://forums.phpfreaks.com/topic/140516-send-current-date-and-time-to-mysql-datetime-field/#findComment-735316 Share on other sites More sharing options...
s_ainley87 Posted January 12, 2009 Author Share Posted January 12, 2009 the qeury is built by Zend and _save function so I can't i dont think Link to comment https://forums.phpfreaks.com/topic/140516-send-current-date-and-time-to-mysql-datetime-field/#findComment-735320 Share on other sites More sharing options...
ngreenwood6 Posted January 12, 2009 Share Posted January 12, 2009 Why don't you just save it as a timestamp? you can convert timestamps back to a date. Alot easier and better for storage. Link to comment https://forums.phpfreaks.com/topic/140516-send-current-date-and-time-to-mysql-datetime-field/#findComment-735339 Share on other sites More sharing options...
premiso Posted January 12, 2009 Share Posted January 12, 2009 Obviously that will not work, look at the format. $date = date("Y-m-d H:i:s") It should enter properly using that. Link to comment https://forums.phpfreaks.com/topic/140516-send-current-date-and-time-to-mysql-datetime-field/#findComment-735340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.