Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Date::range_to_array and Daylight Savings
TreeNode
August 2013
$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!
Harro
August 2013
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.
TreeNode
August 2013
Thanks!
Harro
August 2013
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.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
August 2013
TreeNode
August 2013