I capture the date in various PHP/MySQL interactions on my site. I recently moved my domain to dreamhost, and quickly realized that I took for granted that the my old host’s servers were in the same time zone as my site. Now all the dates that get entered are 3 hours behind. MySQL strores the dates in a datetime field in the format YYYY-MM-DD HH:MM:SS (24-hour time), and is generated using PHP date(‘Y-m-d H:i:s’).
Is there an easy way to add 3 hours to the time I’m getting off the server? This of course means that the day/month/year may also be affected in certain circumstances. Is there a way to set the server time to EST rather than PST?
Thanks for your help!
Edit: So I am impulsive and post when I should just work this stuff out, and this is a really easy problem to solve:
$servertime = date(‘U’); //gets PST Unix timestamp
$est_timestamp = $servertime 10800 //add 3 hours
$est_date = date(‘Y-m-d H:i:s’, $est_timestamp); //format for MySQL DATETIME field
Still wondering if you can alter the time delivered from the server directly. This might be ridiculous, but I know nothing of how these things work.