diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index 668a7bebbe7c..ee0f0aa0c5c6 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -366,7 +366,9 @@ Viewing Differences =================== To compare two Times directly, you would use the ``difference()`` method, which returns a ``CodeIgniter\I18n\TimeDifference`` -instance. The first parameter is either a Time instance, a DateTime instance, or a string with the date/time. If +instance. + +The first parameter is either a Time instance, a DateTime instance, or a string with the date/time. If a string is passed in the first parameter, the second parameter can be a timezone string: .. literalinclude:: time/038.php @@ -377,6 +379,12 @@ the original time: .. literalinclude:: time/039.php +.. note:: When calculating the difference in the number of days, unexpected results + may be returned if a day is not 24 hours long due to Daylight Saving Time + (DST). + + .. literalinclude:: time/042.php + You can use either ``getX()`` methods, or access the calculate values as if they were properties: .. literalinclude:: time/040.php diff --git a/user_guide_src/source/libraries/time/042.php b/user_guide_src/source/libraries/time/042.php new file mode 100644 index 000000000000..c5b521f75277 --- /dev/null +++ b/user_guide_src/source/libraries/time/042.php @@ -0,0 +1,10 @@ +difference($test); + +echo $diff->getDays(); // 0