Jump to content

format date/time for database


jonaHill87

Recommended Posts

Hi. I'm trying to get the current date/time and then put it in a database for later use(select and display using php). So far I have a var that's gets the date/time: $now = date("Y-m-d"); Then I insert it the database using a simple insert command: INSERT INTO table VALUES('$now'); My field is a DATETIME field. If I select and display the data in this field with php, it displays as 2008-03-17 00:00:00. So it's getting the date but not the time. How can I do this to get the time as well as the date? Thanks to anyone that helps.

Link to comment
https://forums.phpfreaks.com/topic/96622-format-datetime-for-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.