title: Timezone and Daylight Savings Issues
body: <p>I've looked through the other solutions on SO and none of them seem to address the timezone/dst issue in the following regard.</p>
  
  <p>I am making calls to <a href="http://opendap.co-ops.nos.noaa.gov/axis/" rel="nofollow">NOAA Tide Prediction API</a> and <a href="http://graphical.weather.gov/xml/rest.php" rel="nofollow">NOAA National Weather Service API</a> which require a time range to be passed for retrieving data. For each location in my database, I have the timezone as a UTC offset and whether daylight savings time is observed (either 1 or 0). I'm trying to format some dates (todays and tomorrow) to be what the LST (Local Standard Time) would be in it's own timezone so I can pass to these API's.</p>
  
  <p>I'm having trouble figuring out how to know if a date, such as todays, is within the daylight savings time range or not.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>// Get name of timezone for tide station
  // NOTE: $locationdata-&gt;timezone is something like "-5"
  $tz_name = timezone_name_from_abbr("", $locationdata-&gt;timezone * 3600, false);
  $dtz = new DateTimeZone($tz_name);    
  
  // Create time range
  $start_time = new DateTime('', $dtz);
  $end_time = new DateTime('', $dtz);
  $end_time = $end_time-&gt;modify('+1 day');
  
  // Modify time to match local timezone
  $start_time-&gt;setTimezone($dtz);
  $end_time-&gt;setTimezone($dtz);
  
  // Adjust for daylight savings time
  if( $locationdata-&gt;dst == '1' )
  {
     // DST is observed in this area. 
  
     // ** HOW DO I KNOW IF TODAY IS CURRENTLY DST OR NOT? **  
  
  }           
  
  // Make call to API using modified time range
  ...
  </code></pre>
  
  <p>How can I go about doing this? Thanks.</p>