PHP Time Zone Adjustment

Posted by emailq on Stack Overflow See other posts from Stack Overflow or by emailq
Published on 2010-05-28T19:49:34Z Indexed on 2010/05/28 19:52 UTC
Read the original article Hit count: 140

Filed under:
|
|

I have a time that is being sent to me in UTC time, but I want to adjust it so its the outer edges of the days on East Coast time (EST/EDT). That is, I want the user to be able to enter in EDT/EST centric dates, and have it query with the UTC correct dates.

$start_date and $end_date are MM/DD/YYYY formatted dates passed via a GET variable.

 $start_date = date('Y-m-d 00:00:00', $start_date);
 $end_date = date('Y-m-d 23:59:59', $end_date);

These dates are for use in a database query, whose times are stored in UTC time.

So, I want the start date to be the day before at 8pm or 7pm, depending on daylight savings, and then to end at 7:59:59 or 6:59:59, again depending on daylight savings.

How would I do that?

© Stack Overflow or respective owner

Related posts about php

Related posts about timezone