Jason92s
asked on
Help with retrieving datetime field in PHP from MySQL
Hi, my MySQL table has a field called submitted_date that is a "datetime" type. My problem is the web host's time is 1 hour ahead of our local time, so it's storing it one hour ahead of the time the user actually submitted it. I called them and they said I can't do anything in terms of modifying a php.ini file to fix it.
In my PHP file, when the user submits the form, I set the "submitted_date" field to now() when it's inserted into MySQL. I retrieve the date using this line:
SELECT name, DATE_FORMAT(submitted_date , '%M %e %l:%i%p') as newdate.....
It then shows the time as being 1 hour ahead of the actual submitted time. I know there must be an easy way to fix this so it shows the true time it was submitted by the user, but I can't figure it out. Thank you.
In my PHP file, when the user submits the form, I set the "submitted_date" field to now() when it's inserted into MySQL. I retrieve the date using this line:
SELECT name, DATE_FORMAT(submitted_date
It then shows the time as being 1 hour ahead of the actual submitted time. I know there must be an easy way to fix this so it shows the true time it was submitted by the user, but I can't figure it out. Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER