corbeeresearch Posted October 1, 2010 Share Posted October 1, 2010 Hi, I'm trying to insert this $inceptiondate = date("Y-m-d 12:00:00"); to the database, the Y-m-d does make it to database, but the 12:00pm doesn't. Whenever it reaches the database, it becomes 00:00:00 Where did I got wrong? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/ Share on other sites More sharing options...
$php_mysql$ Posted October 1, 2010 Share Posted October 1, 2010 why not use now() Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/#findComment-1117861 Share on other sites More sharing options...
chintansshah Posted October 1, 2010 Share Posted October 1, 2010 Hey corbeeresearch, date() first parameter is only format only. for more information go to http://php.net/manual/en/function.date.php Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/#findComment-1117908 Share on other sites More sharing options...
PFMaBiSmAd Posted October 1, 2010 Share Posted October 1, 2010 You can put literal characters into the format string. Any literal characters that happen to be valid format specifiers must be escaped. Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/#findComment-1117911 Share on other sites More sharing options...
Pikachu2000 Posted October 1, 2010 Share Posted October 1, 2010 Is there a possibility that 12:00:00 is being interpreted as midnight (00:00:00)? Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/#findComment-1117950 Share on other sites More sharing options...
corbeeresearch Posted October 8, 2010 Author Share Posted October 8, 2010 Thanks, I was able to solve it. It appears that I have a substr in my model section set to 10 characters, I changed it to 20 and it worked. Quote Link to comment https://forums.phpfreaks.com/topic/214882-php-date-time-to-mysql-format/#findComment-1120139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.