title: timezone with DST handling by PHP
body: <p>I am working on a calendar application. In this users from different time-zones create/view events.
  I am thinking to follow below method to save event time in UTC and display them in user's local time. Note: user has their preferred timezone setting.</p>
  
  <p><strong>To save event start time as UTC timestamp:</strong></p>
  
  <pre><code>$timezone = new DateTimeZone( $user_timezone_name );
  $utcOffset = $timezone-&gt;getOffset( new DateTime( $event_start_time_string_local ) );
  $event_start_timestamp_local = maketime( $event_start_time_string_local );
  //Now add/subtract $utcOffset to/from $event_start_timestamp_local to get event's start  //time  timestamp in UTC and save this result in DB.
  </code></pre>
  
  <p><strong>To get event start time in user's timezone:</strong></p>
  
  <pre><code>date_default_timezone_set( $user_timezone_name );
  $eventTimeLocalTime = date("Y-m-d H:i:s", $event_start_timestamp_in_UTC );
  </code></pre>
  
  <p>Where:</p>
  
  <pre><code>user_timezone_name is user's timezone setting.
  event_start_time_string_local is event's start time string in local/civil time.
  event_start_timestamp_in_UTC is event's start time timestamp in UTC.
  </code></pre>
  
  <p><strong>My questions:</strong> </p>
  
  <ul>
  <li>Whether the PHP APIs used above take care of DST for all regions?</li>
  <li>The DST time itself changes in different years, how does PHP gets information about this? do we need to upgrade PHP? If so do we need to upgrade all or particular PHP library?</li>
  </ul>
  
  <p>References:
   - <a href="https://stackoverflow.com/questions/7660240/does-phps-date-default-timezone-set-adjust-to-daylight-saving?rq=1">does-phps-date-default-timezone-set-adjust-to-daylight-saving</a>
   - <a href="https://stackoverflow.com/questions/3910500/get-timezone-offset-for-a-given-location?rq=1">get-timezone-offset-for-a-given-location</a></p>