Reputation: 2167
I'm trying to use a timestamp for mysql entries, however it's showing up as behind 20 hours.
When I type the following into mysql command line the correct time is displayed (it's currently 8:15 PM Eastern)
SELECT NOW();
When I submit something into my database using the following, everything is correct except the time is being displayed as 12:15 am.
date('m/d/Y,h:i:a');
The column in my table is varchar(20) if that matters.
I also tried to make sure it's set to eastern timezone by using but got an error saying incorrect timezone.
SET time_zone = 'America/New_York';
Does anyone have a clue why I'm off by 20 hours in my databse entries but when I use mysql command line to look up the time it's displayed correctly?
Upvotes: 1
Views: 160
Reputation: 10638
I'm assuming this is a PHP timezone issue. You should check what Timezone you have set in your PHP ini file.
[Date]
; Defines the default timezone used by the date functions
date.timezone = America/New_York
You can also set the timezone in your script:
ini_set('date.timezone', 'America/New_York');
Seems like you were trying to change the Timezone in MySQL. You should also check your timezone setting MySQL, just to make sure.
Upvotes: 2