Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Date::range_to_array and Daylight Savings
  •     $days = Date::range_to_array(strtotime('2013-11-02'), strtotime('2013-11-05'));

        foreach ($days as $day){
          $timestamp = $day->get_timestamp();
          echo date('Y-m-d', $timestamp) . '<br />';
        }


    Produces:

    2013-11-02
    2013-11-03
    2013-11-03
    2013-11-04


    Daylight Savings for my local is on November 3rd. Is there any way to fix this? Thanks!
  • HarroHarro
    Accepted Answer
    Short answer: No, most of PHP's date/time function haven't got a clue about timezones and DST.

    Long answer: This is addressed in Fuel v2, which has a completely rewritten date class that is fully timezone aware.
  • It doesn't have any external dependencies, so you could use it now in any v1 application, probably only a namespace change is needed: https://github.com/fuelphp/common/blob/master/src/Fuel/Common/Date.php

    It requires the same type of config as the current v1 Date class, but with keys camelcased instead of snake_cased. See https://github.com/fuelphp/foundation/blob/master/defaults/config/date.php for the Fuel 2 defaults.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion