File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
user_guide_src/source/libraries Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,15 @@ the original time:
379379
380380.. literalinclude :: time/039.php
381381
382+ .. note :: Prior to v4.4.7, Time always converted the time zones to UTC before
383+ comparison. This could lead to unexpected results when containing a day
384+ differed from 24 hours due to Daylight Saving Time (DST).
385+
386+ Starting with v4.4.7, when comparing date/times that are in the same
387+ time zone, the comparison is performed as is, without conversion to UTC.
388+
389+ .. literalinclude :: time/042.php
390+
382391You can use either ``getX() `` methods, or access the calculate values as if they were properties:
383392
384393.. literalinclude :: time/040.php
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use CodeIgniter \I18n \Time ;
4+
5+ // 31 Mar 2024 - Daylight Saving Time Starts
6+ $ current = Time::parse ('2024-03-31 ' , 'Europe/Madrid ' );
7+ $ test = Time::parse ('2024-04-01 ' , 'Europe/Madrid ' );
8+
9+ $ diff = $ current ->difference ($ test );
10+
11+ echo $ diff ->getDays (); // 0 in v4.4.6 or before
12+ // 1 in v4.4.7 or later
You can’t perform that action at this time.
0 commit comments