From 5e6ad18c9f72498ef12d838827178f672776e630 Mon Sep 17 00:00:00 2001 From: AllenJB Date: Sun, 28 Sep 2025 17:39:12 +0100 Subject: [PATCH 1/4] Enable runnable (WASM) examples for datetime --- reference/datetime/book.xml | 2 +- reference/datetime/dateinterval/construct.xml | 5 +- .../dateinterval/createfromdatestring.xml | 8 +- reference/datetime/dateinterval/format.xml | 9 --- reference/datetime/dateperiod.xml | 7 +- reference/datetime/dateperiod/construct.xml | 4 +- .../dateperiod/createfromiso8601string.xml | 2 - .../datetime/dateperiod/getdateinterval.xml | 3 +- reference/datetime/dateperiod/getenddate.xml | 2 - .../datetime/dateperiod/getrecurrences.xml | 9 ++- .../datetime/dateperiod/getstartdate.xml | 3 +- .../datetime/datetime/createfromimmutable.xml | 4 +- .../datetime/datetime/createfrominterface.xml | 4 +- reference/datetime/datetime/modify.xml | 12 +-- reference/datetime/datetime/settimezone.xml | 11 ++- .../datetime/datetimeimmutable/construct.xml | 29 ++++--- .../datetimeimmutable/createfromformat.xml | 21 ++--- .../datetimeimmutable/createfrominterface.xml | 4 +- .../datetimeimmutable/createfrommutable.xml | 4 +- .../datetimeimmutable/getlasterrors.xml | 54 ++++++++++--- .../datetime/datetimeimmutable/modify.xml | 4 +- .../datetime/datetimeimmutable/setdate.xml | 4 +- .../datetime/datetimeimmutable/setisodate.xml | 19 +++-- .../datetime/datetimeimmutable/settime.xml | 2 +- .../datetimeimmutable/settimestamp.xml | 3 +- .../datetimeimmutable/settimezone.xml | 2 +- reference/datetime/datetimeimmutable/sub.xml | 2 +- reference/datetime/datetimeinterface/diff.xml | 13 +-- .../datetime/datetimeinterface/format.xml | 6 ++ .../datetime/datetimeinterface/getoffset.xml | 11 ++- .../datetimeinterface/gettimestamp.xml | 13 +-- .../datetimeinterface/gettimezone.xml | 14 ++-- .../datetime/datetimeinterface/serialize.xml | 3 +- .../datetimeinterface/unserialize.xml | 2 +- reference/datetime/datetimezone/construct.xml | 10 ++- .../datetime/datetimezone/getlocation.xml | 1 - reference/datetime/datetimezone/getoffset.xml | 7 +- .../datetime/datetimezone/gettransitions.xml | 43 +++++----- .../datetimezone/listabbreviations.xml | 39 ++++++--- reference/datetime/examples.xml | 4 - reference/datetime/formats.xml | 1 - reference/datetime/functions/checkdate.xml | 1 - .../functions/date-default-timezone-get.xml | 5 +- .../functions/date-default-timezone-set.xml | 4 +- .../functions/date-parse-from-format.xml | 7 +- reference/datetime/functions/date-parse.xml | 6 -- .../datetime/functions/date-sun-info.xml | 4 - reference/datetime/functions/date-sunrise.xml | 7 +- reference/datetime/functions/date-sunset.xml | 7 +- reference/datetime/functions/date.xml | 58 ++++---------- reference/datetime/functions/getdate.xml | 17 ++-- reference/datetime/functions/gettimeofday.xml | 2 - reference/datetime/functions/gmdate.xml | 18 +++-- reference/datetime/functions/gmmktime.xml | 10 ++- reference/datetime/functions/gmstrftime.xml | 1 - reference/datetime/functions/idate.xml | 13 ++- reference/datetime/functions/localtime.xml | 1 - reference/datetime/functions/microtime.xml | 10 +-- reference/datetime/functions/mktime.xml | 80 ++++++++++++++++--- reference/datetime/functions/strftime.xml | 8 +- reference/datetime/functions/strptime.xml | 1 - reference/datetime/functions/strtotime.xml | 2 - reference/datetime/functions/time.xml | 1 - .../functions/timezone-name-from-abbr.xml | 1 - .../functions/timezone-version-get.xml | 1 - 65 files changed, 367 insertions(+), 298 deletions(-) diff --git a/reference/datetime/book.xml b/reference/datetime/book.xml index f0ac60ef17ed..31fef728e4dd 100644 --- a/reference/datetime/book.xml +++ b/reference/datetime/book.xml @@ -1,7 +1,7 @@ - + Date and Time Date/Time diff --git a/reference/datetime/dateinterval/construct.xml b/reference/datetime/dateinterval/construct.xml index 49c77f41e01a..ed300ac32a37 100644 --- a/reference/datetime/dateinterval/construct.xml +++ b/reference/datetime/dateinterval/construct.xml @@ -188,7 +188,9 @@ echo $interval->format("%d"); &example.outputs; + @@ -199,11 +201,8 @@ echo $interval->format("%d"); ]]> &example.outputs.82; diff --git a/reference/datetime/dateinterval/createfromdatestring.xml b/reference/datetime/dateinterval/createfromdatestring.xml index 9297cb0f9c83..0ec5291fc22b 100644 --- a/reference/datetime/dateinterval/createfromdatestring.xml +++ b/reference/datetime/dateinterval/createfromdatestring.xml @@ -106,7 +106,7 @@ Parsing valid date intervals - + ]]> @@ -146,13 +145,14 @@ echo $i->format('%d %h %i'), "\n"; $i = DateInterval::createFromDateString('1 year - 10 days'); echo $i->format('%y %d'), "\n"; -?> ]]> &example.outputs; - + + diff --git a/reference/datetime/dateinterval/format.xml b/reference/datetime/dateinterval/format.xml index 600c10adc272..539923de8c8b 100644 --- a/reference/datetime/dateinterval/format.xml +++ b/reference/datetime/dateinterval/format.xml @@ -185,11 +185,8 @@ format('%d days'); - -?> ]]> &example.outputs; @@ -206,11 +203,8 @@ echo $interval->format('%d days'); format('%d days'); - -?> ]]> &example.outputs; @@ -230,7 +224,6 @@ echo $interval->format('%d days'); diff($january); @@ -241,8 +234,6 @@ echo $interval->format('%a total days')."\n"; // While %d will only output the number of days not already covered by the // month. echo $interval->format('%m month, %d days'); - -?> ]]> &example.outputs; diff --git a/reference/datetime/dateperiod.xml b/reference/datetime/dateperiod.xml index 960e46a3be57..92fef3d76c7c 100644 --- a/reference/datetime/dateperiod.xml +++ b/reference/datetime/dateperiod.xml @@ -162,7 +162,8 @@ -recurrences, "\n"; $period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE); echo $period->recurrences, "\n"; -?>]]> +]]> &example.outputs; + diff --git a/reference/datetime/dateperiod/construct.xml b/reference/datetime/dateperiod/construct.xml index 491c6164e37c..8ed6b8a60821 100644 --- a/reference/datetime/dateperiod/construct.xml +++ b/reference/datetime/dateperiod/construct.xml @@ -210,7 +210,6 @@ $period = new DatePeriod($iso); foreach ($period as $date) { echo $date->format('Y-m-d')."\n"; } -?> ]]> &example.outputs; @@ -231,6 +230,7 @@ foreach ($period as $date) { format('Y-m-d')."\n"; } -?> ]]> &example.outputs; @@ -273,7 +272,6 @@ $period = new DatePeriod($begin, $interval, $end, DatePeriod::EXCLUDE_START_DATE foreach ($period as $dt) { echo $dt->format('l Y-m-d'), "\n"; } -?> ]]> &example.outputs; diff --git a/reference/datetime/dateperiod/createfromiso8601string.xml b/reference/datetime/dateperiod/createfromiso8601string.xml index f077a62024bd..29aafc1534a6 100644 --- a/reference/datetime/dateperiod/createfromiso8601string.xml +++ b/reference/datetime/dateperiod/createfromiso8601string.xml @@ -122,7 +122,6 @@ format('Y-m-d'), "\n"; } -?> ]]> &example.outputs; diff --git a/reference/datetime/dateperiod/getdateinterval.xml b/reference/datetime/dateperiod/getdateinterval.xml index 78c4cf119d10..43110f0091fe 100644 --- a/reference/datetime/dateperiod/getdateinterval.xml +++ b/reference/datetime/dateperiod/getdateinterval.xml @@ -40,10 +40,9 @@ getDateInterval(); echo $interval->format('%d day'); -?> ]]> &example.outputs; diff --git a/reference/datetime/dateperiod/getenddate.xml b/reference/datetime/dateperiod/getenddate.xml index aa029a0f0eb6..2a3edd72a0b6 100644 --- a/reference/datetime/dateperiod/getenddate.xml +++ b/reference/datetime/dateperiod/getenddate.xml @@ -60,7 +60,6 @@ $period = new DatePeriod( ); $start = $period->getEndDate(); echo $start->format(DateTime::ISO8601); -?> ]]> &examples.outputs; @@ -81,7 +80,6 @@ $period = new DatePeriod( 7 ); var_dump($period->getEndDate()); -?> ]]> &example.outputs; diff --git a/reference/datetime/dateperiod/getrecurrences.xml b/reference/datetime/dateperiod/getrecurrences.xml index 0c7e1f91a1ef..99d628f2f29d 100644 --- a/reference/datetime/dateperiod/getrecurrences.xml +++ b/reference/datetime/dateperiod/getrecurrences.xml @@ -27,7 +27,7 @@ &reftitle.returnvalues; The number of recurrences as set by explicitly passing the - $recurrences to the contructor of the + $recurrences to the constructor of the DatePeriod class, or &null; otherwise. @@ -38,7 +38,8 @@ Different values for <methodname>DatePeriod::getRecurrences</methodname> -getRecurrences()); $period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE); var_dump($period->getRecurrences()); -?>]]> +]]> &example.outputs; + diff --git a/reference/datetime/dateperiod/getstartdate.xml b/reference/datetime/dateperiod/getstartdate.xml index 58cbb12e614b..22e19d1734d1 100644 --- a/reference/datetime/dateperiod/getstartdate.xml +++ b/reference/datetime/dateperiod/getstartdate.xml @@ -46,10 +46,9 @@ getStartDate(); echo $start->format(DateTime::ISO8601); -?> ]]> &example.outputs; diff --git a/reference/datetime/datetime/createfromimmutable.xml b/reference/datetime/datetime/createfromimmutable.xml index 51fde5018075..965e3532f38d 100644 --- a/reference/datetime/datetime/createfromimmutable.xml +++ b/reference/datetime/datetime/createfromimmutable.xml @@ -70,13 +70,11 @@ Creating a mutable date time object - + ]]> diff --git a/reference/datetime/datetime/createfrominterface.xml b/reference/datetime/datetime/createfrominterface.xml index a98ea99a0ee0..58234d1021c4 100644 --- a/reference/datetime/datetime/createfrominterface.xml +++ b/reference/datetime/datetime/createfrominterface.xml @@ -45,16 +45,14 @@ Creating a mutable date time object - + ]]> diff --git a/reference/datetime/datetime/modify.xml b/reference/datetime/datetime/modify.xml index 97d738de1345..8b5a4281650f 100644 --- a/reference/datetime/datetime/modify.xml +++ b/reference/datetime/datetime/modify.xml @@ -92,9 +92,14 @@ $date = new DateTime('2006-12-12'); $date->modify('+1 day'); echo $date->format('Y-m-d'); -?> ]]> + &example.outputs; + + + &style.procedural; format('Y-m-d'); $date = date_create('2006-12-12'); date_modify($date, '+1 day'); echo date_format($date, 'Y-m-d'); -?> ]]> - &examples.outputs; + &example.outputs; format('Y-m-d') . "\n"; $date->modify('+1 month'); echo $date->format('Y-m-d') . "\n"; -?> ]]> &example.outputs; @@ -150,7 +153,6 @@ echo $date->format('Y-m-d H:i') . "\n"; $date->modify('17:30'); echo $date->format('Y-m-d H:i') . "\n"; -?> ]]> &example.outputs; diff --git a/reference/datetime/datetime/settimezone.xml b/reference/datetime/datetime/settimezone.xml index 2bfd15740162..275cfb68cb92 100644 --- a/reference/datetime/datetime/settimezone.xml +++ b/reference/datetime/datetime/settimezone.xml @@ -70,9 +70,15 @@ echo $date->format('Y-m-d H:i:sP') . "\n"; $date->setTimezone(new DateTimeZone('Pacific/Chatham')); echo $date->format('Y-m-d H:i:sP') . "\n"; -?> ]]> + &example.outputs; + + + &style.procedural; ]]> - &examples.outputs; + &example.outputs; format('Y-m-d'); -?> ]]> + &example.outputs; + + + &style.procedural; ]]> - &examples.outputs; + &example.outputs; format('Y-m-d H:i:sP') . "\n"; @@ -169,7 +175,7 @@ echo $date->format('Y-m-d H:i:sP') . "\n"; $date = new DateTimeImmutable('2000-01-01', new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . "\n"; -// Current date/time in your computer's time zone. +// Current date/time in your PHP's default time zone. $date = new DateTimeImmutable(); echo $date->format('Y-m-d H:i:sP') . "\n"; @@ -184,7 +190,6 @@ echo $date->format('Y-m-d H:i:sP') . "\n"; // Non-existent values roll over. $date = new DateTimeImmutable('2000-02-30'); echo $date->format('Y-m-d H:i:sP') . "\n"; -?> ]]> &example.outputs.similar; @@ -198,6 +203,12 @@ echo $date->format('Y-m-d H:i:sP') . "\n"; 2000-03-01 00:00:00-05:00 ]]> + + + Rolled over dates can be detected by checking for warnings using + DateTimeImmutable::getLastErrors. + + @@ -210,14 +221,13 @@ $timeZone = new \DateTimeZone('Asia/Tokyo'); $time = new \DateTimeImmutable(); $time = $time->setTimezone($timeZone); -echo $time->format('Y/m/d H:i:s'), "\n"; -?> +echo $time->format('Y/m/d H:i:s e'), "\n"; ]]> &example.outputs.similar; @@ -230,7 +240,6 @@ echo $time->format('Y/m/d H:i:s'), "\n"; $time = new \DateTimeImmutable("-1 year"); echo $time->format('Y/m/d H:i:s'), "\n"; -?> ]]> &example.outputs.similar; diff --git a/reference/datetime/datetimeimmutable/createfromformat.xml b/reference/datetime/datetimeimmutable/createfromformat.xml index d2aeff8ad55a..139352df2dcc 100644 --- a/reference/datetime/datetimeimmutable/createfromformat.xml +++ b/reference/datetime/datetimeimmutable/createfromformat.xml @@ -504,7 +504,6 @@ format('Y-m-d'); -?> ]]> @@ -515,9 +514,17 @@ echo $date->format('Y-m-d'); +$date = DateTimeImmutable::createFromFormat( + DateTimeInterface::ISO8601, + '2004-02-12T15:19:21+00:00' +); +echo $date->format('c e') . "\n"; + +$date = DateTimeImmutable::createFromFormat( + DateTimeInterface::RFC3339_EXTENDED, + '2013-10-14T09:00:00.000+02:00' +); +echo $date->format('c e') . "\n"; ]]> @@ -557,7 +564,6 @@ echo "Format: $format; " . $date->format('Y-m-d H:i:s') . "\n"; $format = 'i'; $date = DateTimeImmutable::createFromFormat($format, '15'); echo "Format: $format; " . $date->format('Y-m-d H:i:s') . "\n"; -?> ]]> &example.outputs.similar; @@ -579,7 +585,6 @@ Format: i; 2022-06-02 00:15:00 format('H:i:s'); -?> ]]> &example.outputs.similar; @@ -596,7 +601,6 @@ echo DateTimeImmutable::createFromFormat('H\h i\m s\s','23h 15m 03s')->format('H format(DateTimeImmutable::RFC2822); -?> ]]> &example.outputs.similar; @@ -645,7 +649,6 @@ Sat, 04 Jun 2022 17:01:37 +0000 format(DateTime::RFC1123), "\n"; -?> ]]> &example.outputs.similar; @@ -691,7 +694,6 @@ $d = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2021-17-35 16:60:97'); echo $d->format(DateTimeImmutable::RFC2822), "\n\n"; var_dump(DateTimeImmutable::GetLastErrors()); -?> ]]> &example.outputs.similar; @@ -723,7 +725,6 @@ array(4) { ]]> &example.outputs.similar; diff --git a/reference/datetime/datetimeimmutable/createfrominterface.xml b/reference/datetime/datetimeimmutable/createfrominterface.xml index dd2de3ce81af..ea9eab8838e2 100644 --- a/reference/datetime/datetimeimmutable/createfrominterface.xml +++ b/reference/datetime/datetimeimmutable/createfrominterface.xml @@ -45,16 +45,14 @@ Creating an immutable date time object - + ]]> diff --git a/reference/datetime/datetimeimmutable/createfrommutable.xml b/reference/datetime/datetimeimmutable/createfrommutable.xml index c3a7c5c2e4c5..c2840fb7c39a 100644 --- a/reference/datetime/datetimeimmutable/createfrommutable.xml +++ b/reference/datetime/datetimeimmutable/createfrommutable.xml @@ -70,13 +70,11 @@ Creating an immutable date time object - + ]]> diff --git a/reference/datetime/datetimeimmutable/getlasterrors.xml b/reference/datetime/datetimeimmutable/getlasterrors.xml index fe970a9bd7a8..f903330bba6f 100644 --- a/reference/datetime/datetimeimmutable/getlasterrors.xml +++ b/reference/datetime/datetimeimmutable/getlasterrors.xml @@ -71,35 +71,63 @@ try { print_r(DateTimeImmutable::getLastErrors()); // The real object-oriented way to do this is - // echo $e->getMessage(); + echo $e->getMessage(); } ?> ]]> - &examples.outputs; + &example.outputs; 1 - [warnings] => Array - ( - [6] => Double timezone specification - ) - - [error_count] => 1 - [errors] => Array - ( - [0] => The timezone could not be found in the database - ) + [warning_count] => 1 + [warnings] => Array + ( + [6] => Double timezone specification + ) + [error_count] => 1 + [errors] => Array + ( + [0] => The timezone could not be found in the database + ) ) +Failed to parse time string (asdfasdf) at position 0 (a): The timezone could not be found in the database ]]> The indexes 6, and 0 in the example output refer to the character index in the string where the error occurred. + + Detecting rolled over dates + + + + &example.outputs; + + 1 + [warnings] => Array + ( + [10] => The parsed date was invalid + ) + + [error_count] => 0 + [errors] => Array + ( + ) +) +]]> + + diff --git a/reference/datetime/datetimeimmutable/modify.xml b/reference/datetime/datetimeimmutable/modify.xml index 9772bcafd6ca..2793a402ed37 100644 --- a/reference/datetime/datetimeimmutable/modify.xml +++ b/reference/datetime/datetimeimmutable/modify.xml @@ -82,10 +82,9 @@ $date = new DateTimeImmutable('2006-12-12'); $newDate = $date->modify('+1 day'); echo $newDate->format('Y-m-d'); -?> ]]> - &examples.outputs; + &example.outputs; format('Y-m-d') . "\n"; $newDate2 = $newDate1->modify('+1 month'); echo $newDate2->format('Y-m-d') . "\n"; -?> ]]> &example.outputs; diff --git a/reference/datetime/datetimeimmutable/setdate.xml b/reference/datetime/datetimeimmutable/setdate.xml index 01191da8b270..44f4c59db741 100644 --- a/reference/datetime/datetimeimmutable/setdate.xml +++ b/reference/datetime/datetimeimmutable/setdate.xml @@ -69,10 +69,9 @@ $date = new DateTimeImmutable(); $newDate = $date->setDate(2001, 2, 3); echo $newDate->format('Y-m-d'); -?> ]]> - &examples.outputs; + &example.outputs; format('Y-m-d') . "\n"; $newDate = $date->setDate(2001, 14, 3); echo $newDate->format('Y-m-d') . "\n"; -?> ]]> &example.outputs; diff --git a/reference/datetime/datetimeimmutable/setisodate.xml b/reference/datetime/datetimeimmutable/setisodate.xml index 3fb68647f381..6e02e019d5b2 100644 --- a/reference/datetime/datetimeimmutable/setisodate.xml +++ b/reference/datetime/datetimeimmutable/setisodate.xml @@ -67,14 +67,20 @@ setISODate(2008, 2); +$date = $date->setISODate(2008, 2); echo $date->format('Y-m-d') . "\n"; -$date->setISODate(2008, 2, 7); +$date = $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . "\n"; -?> ]]> + &example.outputs; + + + &style.procedural; ]]> - &examples.outputs; + &example.outputs; format('Y-m-d') . "\n"; $newDate = $date->setISODate(2008, 53, 7); echo $newDate->format('Y-m-d') . "\n"; -?> ]]> &example.outputs; @@ -132,10 +136,9 @@ echo $newDate->format('Y-m-d') . "\n"; $date = new DateTimeImmutable(); $newDate = $date->setISODate(2008, 14); echo $newDate->format('n'); -?> ]]> - &examples.outputs; + &example.outputs; format('Y-m-d H:i:s') . "\n"; ?> ]]> - &examples.outputs.similar; + &example.outputs.similar; format('U = Y-m-d H:i:s') . "\n"; $newDate = $date->setTimestamp(1171502725); echo $newDate->format('U = Y-m-d H:i:s') . "\n"; -?> ]]> - &examples.outputs.similar; + &example.outputs.similar; format('Y-m-d H:i:sP') . "\n"; ?> ]]> - &examples.outputs; + &example.outputs; format('Y-m-d') . "\n"; ?> ]]> - &examples.outputs; + &example.outputs; diff($target); echo $interval->format('%R%a days'); -?> ]]> + &example.outputs; + + + &style.procedural; format('%R%a days'); -?> ]]> - &examples.outputs; + &example.outputs; diff($targetTime); echo $interval->format("%H:%I:%S (Full days: %a)"), "\n"; -?> ]]> &example.outputs; @@ -159,7 +162,6 @@ $originalTime = new DateTimeImmutable("2023-01-01 UTC"); $targetTime = new DateTimeImmutable("2023-12-31 UTC"); $interval = $originalTime->diff($targetTime); echo "Full days: ", $interval->format("%a"), "\n"; -?> ]]> &example.outputs; @@ -188,7 +190,6 @@ $date2 = new DateTime("tomorrow"); var_dump($date1 == $date2); var_dump($date1 < $date2); var_dump($date1 > $date2); -?> ]]> &example.outputs; diff --git a/reference/datetime/datetimeinterface/format.xml b/reference/datetime/datetimeinterface/format.xml index c22d0c467f74..4843ea07c028 100644 --- a/reference/datetime/datetimeinterface/format.xml +++ b/reference/datetime/datetimeinterface/format.xml @@ -406,6 +406,12 @@ echo $date->format('Y-m-d H:i:s'); ?> ]]> + &example.outputs; + + + &style.procedural; getOffset() . "\n"; echo $summer->getOffset() . "\n"; -?> ]]> + &example.outputs; + + + &style.procedural; ]]> - &examples.outputs; + &example.outputs; getTimestamp(); -?> ]]> + &example.outputs.similar; + + + &style.procedural; ]]> - &examples.outputs.similar; + &example.outputs.similar; format('Uv'); // Timestamp in milliseconds $micro = (int) $date->format('Uu'); // Timestamp in microseconds echo $milli, "\n", $micro, "\n"; -?> ]]> - &examples.outputs.similar; + &example.outputs.similar; getTimezone(); echo $tz->getName(); -?> ]]> + &example.outputs; + + + &style.procedural; ]]> - &examples.outputs; + &example.outputs; ]]> - &examples.outputs; + &example.outputs; ]]> - &examples.outputs; + &exampls.outputs; setTimezone($tzo); - echo $local->format(DateTimeInterface::RFC2822 . ' — e'), "\n"; + echo $local->format(DateTimeInterface::RFC2822 . ' — e') . "\n"; } -?> ]]> &example.outputs; + @@ -140,16 +141,17 @@ $timezones = array('Europe/London', 'Mars/Phobos', 'Jupiter/Europa'); foreach ($timezones as $tz) { try { $mars = new DateTimeZone($tz); + echo $mars->getName() . "\n"; } catch(Exception $e) { - echo $e->getMessage() . '
'; + echo $e->getMessage() . "\n"; } } -?> ]]> &example.outputs; diff --git a/reference/datetime/datetimezone/getlocation.xml b/reference/datetime/datetimezone/getlocation.xml index 095e18af0db4..98ccd021b647 100644 --- a/reference/datetime/datetimezone/getlocation.xml +++ b/reference/datetime/datetimezone/getlocation.xml @@ -51,7 +51,6 @@ $tz = new DateTimeZone("Asia/Jakarta"); print_r($tz->getLocation()); print_r(timezone_location_get($tz)); -?> ]]> &example.outputs; diff --git a/reference/datetime/datetimezone/getoffset.xml b/reference/datetime/datetimezone/getoffset.xml index f04365721545..f20b744b2bad 100644 --- a/reference/datetime/datetimezone/getoffset.xml +++ b/reference/datetime/datetimezone/getoffset.xml @@ -75,9 +75,14 @@ $timeOffset = $dateTimeZoneJapan->getOffset($dateTimeTaipei); // Should show int(32400) (for dates after Sat Sep 8 01:00:00 1951 JST). var_dump($timeOffset); -?> ]]> + &example.outputs; + + +
diff --git a/reference/datetime/datetimezone/gettransitions.xml b/reference/datetime/datetimezone/gettransitions.xml index ed00ac7ba39c..57c6e84bc37b 100644 --- a/reference/datetime/datetimezone/gettransitions.xml +++ b/reference/datetime/datetimezone/gettransitions.xml @@ -128,29 +128,29 @@ Array ( [0] => Array ( - [ts] => -9223372036854775808 - [time] => -292277022657-01-27T08:29:52+0000 - [offset] => 3600 - [isdst] => 1 - [abbr] => BST + [ts] => -2147483648 + [time] => 1901-12-13T20:45:52+00:00 + [offset] => -75 + [isdst] => + [abbr] => LMT ) [1] => Array ( - [ts] => -1691964000 - [time] => 1916-05-21T02:00:00+0000 - [offset] => 3600 - [isdst] => 1 - [abbr] => BST + [ts] => 442304971 + [time] => 1847-12-01T00:01:15+00:00 + [offset] => 0 + [isdst] => + [abbr] => GMT ) [2] => Array ( - [ts] => -1680472800 - [time] => 1916-10-01T02:00:00+0000 - [offset] => 0 - [isdst] => - [abbr] => GMT + [ts] => -1691964000 + [time] => 1916-05-21T02:00:00+00:00 + [offset] => 3600 + [isdst] => 1 + [abbr] => BST ) ) @@ -177,8 +177,8 @@ Array ( [0] => Array ( - [ts] => 1654184161 - [time] => 2022-06-02T15:36:01+0000 + [ts] => 1759058251 + [time] => 2025-09-28T11:17:31+00:00 [offset] => 3600 [isdst] => 1 [abbr] => BST @@ -186,8 +186,8 @@ Array [1] => Array ( - [ts] => 1667091600 - [time] => 2022-10-30T01:00:00+0000 + [ts] => 1761440400 + [time] => 2025-10-26T01:00:00+00:00 [offset] => 0 [isdst] => [abbr] => GMT @@ -195,15 +195,14 @@ Array [2] => Array ( - [ts] => 1679792400 - [time] => 2023-03-26T01:00:00+0000 + [ts] => 1774746000 + [time] => 2026-03-29T01:00:00+00:00 [offset] => 3600 [isdst] => 1 [abbr] => BST ) ) -]]>
diff --git a/reference/datetime/datetimezone/listabbreviations.xml b/reference/datetime/datetimezone/listabbreviations.xml index 132ad1227c92..685b4ccdcf53 100644 --- a/reference/datetime/datetimezone/listabbreviations.xml +++ b/reference/datetime/datetimezone/listabbreviations.xml @@ -58,7 +58,6 @@ ]]> &example.outputs.similar; @@ -68,30 +67,44 @@ Array ( [0] => Array ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Porto_Acre + [dst] => + [offset] => 34200 + [timezone_id] => Australia/Adelaide ) [1] => Array ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Eirunepe + [dst] => + [offset] => 34200 + [timezone_id] => Australia/Broken_Hill ) [2] => Array ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Rio_Branco + [dst] => + [offset] => 34200 + [timezone_id] => Australia/Darwin ) [3] => Array ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => Brazil/Acre + [dst] => + [offset] => 34200 + [timezone_id] => Australia/North + ) + + [4] => Array + ( + [dst] => + [offset] => 34200 + [timezone_id] => Australia/South + ) + + [5] => Array + ( + [dst] => + [offset] => 34200 + [timezone_id] => Australia/Yancowinna ) ) diff --git a/reference/datetime/examples.xml b/reference/datetime/examples.xml index 1c854718c3f6..e8367cc54cb4 100644 --- a/reference/datetime/examples.xml +++ b/reference/datetime/examples.xml @@ -24,7 +24,6 @@ $dt = new DateTimeImmutable("2015-11-01 00:00:00", new DateTimeZone("America/New echo "Start: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; $dt = $dt->add(new DateInterval("PT3H")); echo "End: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; -?> ]]> &example.outputs; @@ -51,7 +50,6 @@ $dt = new DateTimeImmutable("2015-11-01 00:00:00", new DateTimeZone("America/New echo "Start: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; $dt = $dt->modify("+24 hours"); echo "End: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; -?> ]]> &example.outputs; @@ -84,7 +82,6 @@ $dt = new DateTimeImmutable("2016-01-31 00:00:00", new DateTimeZone("America/New echo "Start: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; $dt = $dt->modify("+1 month"); echo "End: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; -?> ]]> &example.outputs; @@ -116,7 +113,6 @@ $dt = new DateTimeImmutable("2016-01-31 00:00:00", new DateTimeZone("America/New echo "Start: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; $dt = $dt->modify("last day of next month"); echo "End: ", $dt->format("Y-m-d H:i:s P"), PHP_EOL; -?> ]]> &example.outputs; diff --git a/reference/datetime/formats.xml b/reference/datetime/formats.xml index 23f787b7e941..f86bd5f99c72 100644 --- a/reference/datetime/formats.xml +++ b/reference/datetime/formats.xml @@ -84,7 +84,6 @@ ]]> &example.outputs; diff --git a/reference/datetime/functions/checkdate.xml b/reference/datetime/functions/checkdate.xml index 947a66c5bff8..629ed5a32cf7 100644 --- a/reference/datetime/functions/checkdate.xml +++ b/reference/datetime/functions/checkdate.xml @@ -71,7 +71,6 @@ ]]> &example.outputs; diff --git a/reference/datetime/functions/date-default-timezone-get.xml b/reference/datetime/functions/date-default-timezone-get.xml index bfbc09e7dd58..b949851ef160 100644 --- a/reference/datetime/functions/date-default-timezone-get.xml +++ b/reference/datetime/functions/date-default-timezone-get.xml @@ -59,14 +59,12 @@ date_default_timezone_set('Europe/London'); if (date_default_timezone_get()) { - echo 'date_default_timezone_set: ' . date_default_timezone_get() . '
'; + echo 'date_default_timezone_set: ' . date_default_timezone_get() . "\n"; } if (ini_get('date.timezone')) { echo 'date.timezone: ' . ini_get('date.timezone'); } - -?> ]]> &example.outputs.similar; @@ -86,7 +84,6 @@ date.timezone: Europe/London ' . date('e') . ' => ' . date('T'); -?> ]]> &example.outputs; diff --git a/reference/datetime/functions/date-default-timezone-set.xml b/reference/datetime/functions/date-default-timezone-set.xml index 8ba1471693ed..48d0299583cb 100644 --- a/reference/datetime/functions/date-default-timezone-set.xml +++ b/reference/datetime/functions/date-default-timezone-set.xml @@ -64,13 +64,13 @@ date_default_timezone_set('America/Los_Angeles'); $script_tz = date_default_timezone_get(); +$ini_tz = ini_get('date.timezone'); -if (strcmp($script_tz, ini_get('date.timezone'))){ +if (strcmp($script_tz, $ini_tz)){ echo 'Script timezone differs from ini-set timezone.'; } else { echo 'Script timezone and ini-set timezone match.'; } -?> ]]> diff --git a/reference/datetime/functions/date-parse-from-format.xml b/reference/datetime/functions/date-parse-from-format.xml index f658ed5d22d3..a0da7f93996a 100644 --- a/reference/datetime/functions/date-parse-from-format.xml +++ b/reference/datetime/functions/date-parse-from-format.xml @@ -146,7 +146,6 @@ ]]> &example.outputs; @@ -160,7 +159,7 @@ Array [hour] => 13 [minute] => 0 [second] => 0 - [fraction] => + [fraction] => 0 [warning_count] => 0 [warnings] => Array ( @@ -194,7 +193,6 @@ echo "Warnings count: ", $parsed['warning_count'], "\n"; foreach ($parsed['warnings'] as $position => $message) { echo "\tOn position {$position}: {$message}\n"; } -?> ]]> &example.outputs; @@ -220,7 +218,6 @@ echo "Errors count: ", $parsed['error_count'], "\n"; foreach ($parsed['errors'] as $position => $message) { echo "\tOn position {$position}: {$message}\n"; } -?> ]]> &example.outputs; @@ -228,7 +225,7 @@ foreach ($parsed['errors'] as $position => $message) { diff --git a/reference/datetime/functions/date-parse.xml b/reference/datetime/functions/date-parse.xml index edf1a602f40e..f2c33570228f 100644 --- a/reference/datetime/functions/date-parse.xml +++ b/reference/datetime/functions/date-parse.xml @@ -147,7 +147,6 @@ ]]> &example.outputs; @@ -197,7 +196,6 @@ array(12) { ]]> &example.outputs; @@ -248,7 +246,6 @@ array(16) { ]]> &example.outputs; @@ -301,7 +298,6 @@ array(14) { ]]> &example.outputs; @@ -350,7 +346,6 @@ array(12) { ]]> &example.outputs; @@ -417,7 +412,6 @@ array(13) { ]]> &example.outputs; diff --git a/reference/datetime/functions/date-sun-info.xml b/reference/datetime/functions/date-sun-info.xml index 4efd5dc59237..6b9a781ee1d7 100644 --- a/reference/datetime/functions/date-sun-info.xml +++ b/reference/datetime/functions/date-sun-info.xml @@ -179,7 +179,6 @@ $sun_info = date_sun_info(strtotime("2006-12-12"), 31.7667, 35.2333); foreach ($sun_info as $key => $val) { echo "$key: " . date("H:i:s", $val) . "\n"; } -?> ]]> &example.outputs; @@ -218,7 +217,6 @@ foreach ($si as $key => $value) { ": {$key}", "\n"; } -?> ]]> &example.outputs; @@ -246,7 +244,6 @@ never: sunset ]]> &example.outputs; @@ -280,7 +277,6 @@ $diff = $si['sunset'] - $si['sunrise']; echo "Length of day: ", floor($diff / 3600), "h ", floor(($diff % 3600) / 60), "s\n"; -?> ]]> &example.outputs; diff --git a/reference/datetime/functions/date-sunrise.xml b/reference/datetime/functions/date-sunrise.xml index ac4ad7b4ad5c..4223ab3c479d 100644 --- a/reference/datetime/functions/date-sunrise.xml +++ b/reference/datetime/functions/date-sunrise.xml @@ -220,13 +220,13 @@ offset: +1 GMT */ echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1); - -?> ]]> &example.outputs.similar; @@ -238,12 +238,13 @@ Mon Dec 20 2004, sunrise time : 08:54 ]]> &example.outputs; diff --git a/reference/datetime/functions/date-sunset.xml b/reference/datetime/functions/date-sunset.xml index 3f6536cae5ba..a7da44a69b05 100644 --- a/reference/datetime/functions/date-sunset.xml +++ b/reference/datetime/functions/date-sunset.xml @@ -222,13 +222,13 @@ offset: +1 GMT */ echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1); - -?> ]]> &example.outputs.similar; @@ -240,12 +240,13 @@ Mon Dec 20 2004, sunset time : 18:13 ]]> &example.outputs; diff --git a/reference/datetime/functions/date.xml b/reference/datetime/functions/date.xml index 4bff3212903f..8d7b375b05ad 100644 --- a/reference/datetime/functions/date.xml +++ b/reference/datetime/functions/date.xml @@ -106,21 +106,20 @@ date_default_timezone_set('UTC'); // Prints something like: Monday -echo date("l"); +echo date("l") . "\n"; // Prints something like: Monday 8th of August 2005 03:12:46 PM -echo date('l jS \of F Y h:i:s A'); +echo date('l jS \of F Y h:i:s A') . "\n"; // Prints: July 1, 2000 is on a Saturday -echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)); +echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)) . "\n"; /* use the constants in the format parameter */ // prints something like: Wed, 25 Sep 2013 15:28:57 -0700 -echo date(DATE_RFC2822); +echo date(DATE_RFC2822) . "\n"; // prints something like: 2000-07-01T00:00:00+00:00 echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)); -?> ]]> @@ -137,35 +136,10 @@ echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)); ]]>
- - It is possible to use date and - mktime together to find dates in the future - or the past. - - <function>date</function> and <function>mktime</function> example - - -]]> - - - - - This can be more reliable than simply adding or subtracting the number - of seconds in a day or month to a timestamp because of daylight saving - time. - - - Some examples of date formatting. Note that you should escape any other characters, as any which currently @@ -180,18 +154,18 @@ $nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1); +date_default_timezone_set("America/Phoenix"); + +echo date("F j, Y, g:i a") . "\n"; // March 10, 2001, 5:16 pm +echo date("m.d.y") . "\n"; // 03.10.01 +echo date("j, n, Y") . "\n"; // 10, 3, 2001 +echo date("Ymd") . "\n"; // 20010310 +echo date('h-i-s, j-m-y, it is w Day') . "\n"; // 05-16-18, 10-03-01, 1631 1618 6 Satpm01 +echo date('\i\t \i\s \t\h\e jS \d\a\y.') . "\n"; // it is the 10th day. +echo date("D M j G:i:s T Y") . "\n"; // Sat Mar 10 17:16:18 MST 2001 +echo date('H:m:s \m \i\s\ \m\o\n\t\h') . "\n"; // 17:03:18 m is month +echo date("H:i:s") . "\n"; // 17:16:18 +echo date("Y-m-d H:i:s") . "\n"; // 2001-03-10 17:16:18 (the MySQL DATETIME format) ]]> diff --git a/reference/datetime/functions/getdate.xml b/reference/datetime/functions/getdate.xml index 1a419eeecf06..8e433bcad9f4 100644 --- a/reference/datetime/functions/getdate.xml +++ b/reference/datetime/functions/getdate.xml @@ -150,7 +150,6 @@ ]]> &example.outputs.similar; @@ -160,15 +159,15 @@ Array ( [seconds] => 40 [minutes] => 58 - [hours] => 21 - [mday] => 17 - [wday] => 2 - [mon] => 6 - [year] => 2003 - [yday] => 167 + [hours] => 21 + [mday] => 17 + [wday] => 2 + [mon] => 6 + [year] => 2003 + [yday] => 167 [weekday] => Tuesday - [month] => June - [0] => 1055901520 + [month] => June + [0] => 1055901520 ) ]]> diff --git a/reference/datetime/functions/gettimeofday.xml b/reference/datetime/functions/gettimeofday.xml index 25977277dd8a..6c93c0f88b96 100644 --- a/reference/datetime/functions/gettimeofday.xml +++ b/reference/datetime/functions/gettimeofday.xml @@ -79,7 +79,6 @@ print_r(gettimeofday()); echo gettimeofday(true); -?> ]]> &example.outputs.similar; @@ -92,7 +91,6 @@ Array [minuteswest] => 0 [dsttime] => 1 ) - 1073504408.23910 ]]> diff --git a/reference/datetime/functions/gmdate.xml b/reference/datetime/functions/gmdate.xml index 90c4dbcab11c..9468fc66c0d0 100644 --- a/reference/datetime/functions/gmdate.xml +++ b/reference/datetime/functions/gmdate.xml @@ -75,18 +75,22 @@ <function>gmdate</function> example - - When run in Finland (GMT +0200), the first line below prints "Jan 01 - 1998 00:00:00", while the second prints "Dec 31 1997 22:00:00". - +date_default_timezone_set("Europe/Helsinki"); + +echo date("M d Y H:i:s e", mktime(0, 0, 0, 1, 1, 1998)) . "\n"; +echo gmdate("M d Y H:i:s e", mktime(0, 0, 0, 1, 1, 1998)); ]]> + &example.outputs; + + + diff --git a/reference/datetime/functions/gmmktime.xml b/reference/datetime/functions/gmmktime.xml index 7fdd1c0e21a1..470551d9f833 100644 --- a/reference/datetime/functions/gmmktime.xml +++ b/reference/datetime/functions/gmmktime.xml @@ -151,11 +151,17 @@ ]]> + &example.outputs; + + + diff --git a/reference/datetime/functions/gmstrftime.xml b/reference/datetime/functions/gmstrftime.xml index e4102e6274bb..19f16fcf53c4 100644 --- a/reference/datetime/functions/gmstrftime.xml +++ b/reference/datetime/functions/gmstrftime.xml @@ -102,7 +102,6 @@ setlocale(LC_TIME, 'en_US'); echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n"; echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n"; -?> ]]> diff --git a/reference/datetime/functions/idate.xml b/reference/datetime/functions/idate.xml index 4cff3c0e30f9..90d86d4d61a8 100644 --- a/reference/datetime/functions/idate.xml +++ b/reference/datetime/functions/idate.xml @@ -196,15 +196,24 @@ ]]> + &example.outputs; + + + diff --git a/reference/datetime/functions/localtime.xml b/reference/datetime/functions/localtime.xml index f89b3b7b1a18..c2abc514e4b4 100644 --- a/reference/datetime/functions/localtime.xml +++ b/reference/datetime/functions/localtime.xml @@ -148,7 +148,6 @@ $localtime = localtime(); $localtime_assoc = localtime(time(), true); print_r($localtime); print_r($localtime_assoc); -?> ]]> &example.outputs.similar; diff --git a/reference/datetime/functions/microtime.xml b/reference/datetime/functions/microtime.xml index 73413d84955d..3b6c052076eb 100644 --- a/reference/datetime/functions/microtime.xml +++ b/reference/datetime/functions/microtime.xml @@ -68,30 +68,28 @@ $time_start = microtime(true); // Sleep for a while -usleep(100); +usleep(10_000); $time_end = microtime(true); $time = $time_end - $time_start; -echo "Did nothing in $time seconds\n"; -?> +print "Did nothing in $time seconds\n"; ]]> <function>microtime</function> and <literal>REQUEST_TIME_FLOAT</literal> - + ]]> diff --git a/reference/datetime/functions/mktime.xml b/reference/datetime/functions/mktime.xml index 5a05625e8753..5ffdaa5ea933 100644 --- a/reference/datetime/functions/mktime.xml +++ b/reference/datetime/functions/mktime.xml @@ -170,13 +170,19 @@ date_default_timezone_set('UTC'); // Prints: July 1, 2000 is on a Saturday -echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)); +echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)) . "\n"; // Prints something like: 2006-04-05T01:02:03+00:00 -echo date('c', mktime(1, 2, 3, 4, 5, 2006)); -?> +echo date('c', mktime(1, 2, 3, 4, 5, 2006)) . "\n"; ]]> + &example.outputs.similar; + + + @@ -191,14 +197,59 @@ echo date('c', mktime(1, 2, 3, 4, 5, 2006)); +date_default_timezone_set('America/New_York'); + +echo date("c", mktime(0, 0, 0, 12, 32, 1997)) . "\n"; +echo date("c", mktime(0, 0, 0, 13, 1, 1997)) . "\n"; +echo date("c", mktime(0, 0, 0, 1, 1, 1998)) . "\n"; +echo date("c", mktime(0, 0, 0, 1, 1, 98)) . "\n"; +]]> + + &example.outputs.similar; + + + + + + + + Using mktime to find relative dates + + + &example.outputs.similar; + + + + + + This can be more reliable than simply adding or subtracting the number + of seconds in a day or month to a timestamp because of daylight saving + time. + + @@ -213,14 +264,19 @@ echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98)); +echo 'Last day in Feb 2000 is: ', date('d', $lastday) . "\n"; ]]> + &example.outputs; + + + diff --git a/reference/datetime/functions/strftime.xml b/reference/datetime/functions/strftime.xml index a143921b194f..07a39f3b4b8c 100644 --- a/reference/datetime/functions/strftime.xml +++ b/reference/datetime/functions/strftime.xml @@ -421,7 +421,7 @@ in your system. <function>strftime</function> locale examples - + ]]> @@ -486,8 +485,6 @@ echo "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n // Outputs: 1/3/2005 - %V,%G,%Y = 1,2005,2005 echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n"; - -?> ]]> @@ -509,7 +506,6 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { } echo strftime($format); -?> ]]> @@ -600,8 +596,6 @@ foreach ($strftimeValues as $format => $value) { foreach (array_diff_key($strftimeFormats, $strftimeValues) as $format => $description) { echo "Unknown format : '{$format}' ", str_pad(' ', $maxValueLength), ($description ? " ( {$description} )" : ''), "\n"; } - -?> ]]> &example.outputs.similar; diff --git a/reference/datetime/functions/strptime.xml b/reference/datetime/functions/strptime.xml index b4e3de531548..4b622f8d8207 100644 --- a/reference/datetime/functions/strptime.xml +++ b/reference/datetime/functions/strptime.xml @@ -164,7 +164,6 @@ $strf = strftime($format); echo "$strf\n"; print_r(strptime($strf, $format)); -?> ]]> &example.outputs.similar; diff --git a/reference/datetime/functions/strtotime.xml b/reference/datetime/functions/strtotime.xml index ad8a33c2a048..74b4360b1bc6 100644 --- a/reference/datetime/functions/strtotime.xml +++ b/reference/datetime/functions/strtotime.xml @@ -115,7 +115,6 @@ echo strtotime("+1 week"), "\n"; echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; echo strtotime("next Thursday"), "\n"; echo strtotime("last Monday"), "\n"; -?> ]]> @@ -133,7 +132,6 @@ if (($timestamp = strtotime($str)) === false) { } else { echo "$str == " . date('l dS \o\f F Y h:i:s A', $timestamp); } -?> ]]> diff --git a/reference/datetime/functions/time.xml b/reference/datetime/functions/time.xml index 500de7170f70..4757c27c107b 100644 --- a/reference/datetime/functions/time.xml +++ b/reference/datetime/functions/time.xml @@ -48,7 +48,6 @@ ]]> &example.outputs.similar; diff --git a/reference/datetime/functions/timezone-name-from-abbr.xml b/reference/datetime/functions/timezone-name-from-abbr.xml index bc0fbd1c1da2..e2e4b2b87531 100644 --- a/reference/datetime/functions/timezone-name-from-abbr.xml +++ b/reference/datetime/functions/timezone-name-from-abbr.xml @@ -75,7 +75,6 @@ ]]> &example.outputs.similar; diff --git a/reference/datetime/functions/timezone-version-get.xml b/reference/datetime/functions/timezone-version-get.xml index a1f15260043d..81e1ca319931 100644 --- a/reference/datetime/functions/timezone-version-get.xml +++ b/reference/datetime/functions/timezone-version-get.xml @@ -53,7 +53,6 @@ ]]> &example.outputs.similar; From e01ab2bd34a3ac32d2fa011884efef74159d19ca Mon Sep 17 00:00:00 2001 From: AllenJB Date: Sun, 28 Sep 2025 17:57:51 +0100 Subject: [PATCH 2/4] Enable runnable (WASM) examples for datetime --- reference/datetime/datetimeimmutable/construct.xml | 2 +- .../datetime/datetimeimmutable/createfromformat.xml | 4 ++-- reference/datetime/datetimezone/gettransitions.xml | 5 +++-- .../datetime/datetimezone/listabbreviations.xml | 12 ++++++------ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/reference/datetime/datetimeimmutable/construct.xml b/reference/datetime/datetimeimmutable/construct.xml index 722c057e0bb1..943fa828f2a8 100644 --- a/reference/datetime/datetimeimmutable/construct.xml +++ b/reference/datetime/datetimeimmutable/construct.xml @@ -205,7 +205,7 @@ echo $date->format('Y-m-d H:i:sP') . "\n"; - Rolled over dates can be detected by checking for warnings using + Rolled over dates can be detected by checking for warnings using DateTimeImmutable::getLastErrors. diff --git a/reference/datetime/datetimeimmutable/createfromformat.xml b/reference/datetime/datetimeimmutable/createfromformat.xml index 139352df2dcc..bfb4f1b5922a 100644 --- a/reference/datetime/datetimeimmutable/createfromformat.xml +++ b/reference/datetime/datetimeimmutable/createfromformat.xml @@ -515,13 +515,13 @@ echo $date->format('Y-m-d'); format('c e') . "\n"; $date = DateTimeImmutable::createFromFormat( - DateTimeInterface::RFC3339_EXTENDED, + DateTimeInterface::RFC3339_EXTENDED, '2013-10-14T09:00:00.000+02:00' ); echo $date->format('c e') . "\n"; diff --git a/reference/datetime/datetimezone/gettransitions.xml b/reference/datetime/datetimezone/gettransitions.xml index 57c6e84bc37b..632e41790819 100644 --- a/reference/datetime/datetimezone/gettransitions.xml +++ b/reference/datetime/datetimezone/gettransitions.xml @@ -131,7 +131,7 @@ Array [ts] => -2147483648 [time] => 1901-12-13T20:45:52+00:00 [offset] => -75 - [isdst] => + [isdst] => [abbr] => LMT ) @@ -140,7 +140,7 @@ Array [ts] => 442304971 [time] => 1847-12-01T00:01:15+00:00 [offset] => 0 - [isdst] => + [isdst] => [abbr] => GMT ) @@ -203,6 +203,7 @@ Array ) ) +]]> diff --git a/reference/datetime/datetimezone/listabbreviations.xml b/reference/datetime/datetimezone/listabbreviations.xml index 685b4ccdcf53..1875228ac329 100644 --- a/reference/datetime/datetimezone/listabbreviations.xml +++ b/reference/datetime/datetimezone/listabbreviations.xml @@ -67,42 +67,42 @@ Array ( [0] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [1] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [2] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [3] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [4] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [5] => Array ( - [dst] => + [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) From 01e8187dc2e8894ceeb3331213d49d08d96126ca Mon Sep 17 00:00:00 2001 From: AllenJB Date: Sun, 28 Sep 2025 18:01:20 +0100 Subject: [PATCH 3/4] Enable runnable (WASM) examples for datetime --- reference/datetime/datetimeinterface/unserialize.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/datetime/datetimeinterface/unserialize.xml b/reference/datetime/datetimeinterface/unserialize.xml index d5a73dc9207d..e3e46c8727f6 100644 --- a/reference/datetime/datetimeinterface/unserialize.xml +++ b/reference/datetime/datetimeinterface/unserialize.xml @@ -60,7 +60,7 @@ var_dump(unserialize($serializedDate)); ?> ]]> - &exampls.outputs; + &example.outputs; Date: Sun, 28 Sep 2025 18:06:14 +0100 Subject: [PATCH 4/4] Enable runnable (WASM) examples for datetime --- reference/datetime/datetimeinterface/unserialize.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/reference/datetime/datetimeinterface/unserialize.xml b/reference/datetime/datetimeinterface/unserialize.xml index e3e46c8727f6..4af5fb5dab72 100644 --- a/reference/datetime/datetimeinterface/unserialize.xml +++ b/reference/datetime/datetimeinterface/unserialize.xml @@ -57,7 +57,6 @@ ]]> &example.outputs;