1

I'm working with an API that requires DST details for the year that first interval in a time series data falls on.

For example, for an account located in America/Chicago I need to know:

# If data starts in 2014
DST Start: 2014-03-09 02:00:00
DST Stop:  2014-11-02 02:00:00

# If data starts in 2009
DST Start: 2009-03-08 02:00:00
DST Stop:  2009-11-01 02:00:00

PHP has good DataTime functions but how can I find DST details for specific year? I don't want to resort to adding/subtracting arbitrary interval and checking whether or not the date is in daylight savings time $dt->format('I').

I know PHP uses tzdata internally which has all those details but are they exposed? Is there any way to get that data natively in PHP? If not, is there linux utility that I could exec()?

Thank you.

mpz
  • 133
  • 1
  • 4

1 Answers1

0

PHP's DateTimeZone class has a method called getTransitions() that returns this information

Mark Baker
  • 209,507
  • 32
  • 346
  • 385