diff --git a/reference/datetime/dateinterval/createfromdatestring.xml b/reference/datetime/dateinterval/createfromdatestring.xml index 6776fb829a..09d4e68fc0 100644 --- a/reference/datetime/dateinterval/createfromdatestring.xml +++ b/reference/datetime/dateinterval/createfromdatestring.xml @@ -1,6 +1,6 @@ - + @@ -85,6 +85,11 @@ + 8.4.0 + + 仮の戻り値の型が、DateInterval になりました。 + これより前のバージョンでは、DateIntervalfalse でした。 + 8.3.0 無効な文字列が渡された場合、 diff --git a/reference/datetime/dateperiod/construct.xml b/reference/datetime/dateperiod/construct.xml index 9da0cd3518..dd380a8820 100644 --- a/reference/datetime/dateperiod/construct.xml +++ b/reference/datetime/dateperiod/construct.xml @@ -1,6 +1,6 @@ - + @@ -35,9 +35,9 @@ intoptions0 - 代わりに、static なファクトリメソッド - DatePeriod::createFromISO8601String - を使いましょう。 + このコンストラクタのバリエーションは、PHP 8.4.0 以降は非推奨です。 + 代わりに DatePeriod::createFromISO8601String + を使ってください。 @@ -167,6 +167,14 @@ + + 8.4.0 + + isostr を使うシグネチャは非推奨となりました。 + 代わりに DatePeriod::createFromISO8601String + を使ってください。 + + 8.3.0 diff --git a/reference/datetime/datetime/createfromtimestamp.xml b/reference/datetime/datetime/createfromtimestamp.xml new file mode 100644 index 0000000000..391787132d --- /dev/null +++ b/reference/datetime/datetime/createfromtimestamp.xml @@ -0,0 +1,95 @@ + + + + + + DateTime::createFromTimestamp + Unix タイムスタンプからインスタンスを生成する + + + + &reftitle.description; + + public static staticDateTime::createFromTimestamp + intfloattimestamp + + + + Unix タイムスタンプからインスタンスを生成します。 + + + + + &reftitle.parameters; + + + + timestamp + + + 日付を表す Unix タイムスタンプ。 + &float; の値も受け付けるため、マイクロ秒の精度を指定できます。 + + + + + + + + + &reftitle.returnvalues; + + 新しい DateTime インスタンスを返します。 + + + + + &reftitle.errors; + + timestamp が [PHP_INT_MIN, PHP_INT_MAX] + の範囲外の場合、DateRangeError がスローされます。 + + + + + &reftitle.examples; + + <methodname>DateTime::createFromTimestamp</methodname> の例 + +format('Y-m-d H:i:s.u'); +?> +]]> + + &example.outputs; + + + + + + + + diff --git a/reference/datetime/datetime/modify.xml b/reference/datetime/datetime/modify.xml index 1517364c6f..74b1aa44e2 100644 --- a/reference/datetime/datetime/modify.xml +++ b/reference/datetime/datetime/modify.xml @@ -1,6 +1,6 @@ - + @@ -71,6 +71,14 @@ + + 8.4.0 + + 仮の戻り値の型が、DateTime になりました。 + これより前のバージョンでは、 + DateTimefalse でした。 + + 8.3.0 diff --git a/reference/datetime/datetime/setmicrosecond.xml b/reference/datetime/datetime/setmicrosecond.xml new file mode 100644 index 0000000000..16050be47f --- /dev/null +++ b/reference/datetime/datetime/setmicrosecond.xml @@ -0,0 +1,110 @@ + + + + + + DateTime::setMicrosecond + 時刻のマイクロ秒部分を設定する + + + + &reftitle.description; + + public staticDateTime::setMicrosecond + intmicrosecond + + + + 時刻のマイクロ秒部分を設定します。 + + + DateTimeImmutable::setMicrosecond に似ていますが、 + DateTime を使って動作します。 + + + + + &reftitle.parameters; + + + + microsecond + + + 設定するマイクロ秒の値 (0 から 999999)。 + + + + + + + + + &reftitle.returnvalues; + + &date.datetime.return.modifiedobject; + + + + + &reftitle.errors; + + microsecond が + [0, 999999] の範囲外の場合、 + DateRangeError がスローされます。 + + + + + &reftitle.examples; + + <methodname>DateTime::setMicrosecond</methodname> の例 + + +format('Y-m-d H:i:s.u') . PHP_EOL; +$date->setMicrosecond(987654); +echo $date->format('Y-m-d H:i:s.u') . PHP_EOL; +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + DateTimeInterface::getMicrosecond + + + + + diff --git a/reference/datetime/datetime/settimestamp.xml b/reference/datetime/datetime/settimestamp.xml index 4817063a91..9c5afd477b 100644 --- a/reference/datetime/datetime/settimestamp.xml +++ b/reference/datetime/datetime/settimestamp.xml @@ -1,6 +1,6 @@ - + @@ -65,6 +65,7 @@ &reftitle.seealso; DateTimeImmutable::setTimestamp + DateTime::setMicrosecond diff --git a/reference/datetime/datetimeimmutable/add.xml b/reference/datetime/datetimeimmutable/add.xml index f9e8a9a36b..76a57542cd 100644 --- a/reference/datetime/datetimeimmutable/add.xml +++ b/reference/datetime/datetimeimmutable/add.xml @@ -1,6 +1,6 @@ - + @@ -13,7 +13,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::add() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::add DateIntervalinterval diff --git a/reference/datetime/datetimeimmutable/createfromtimestamp.xml b/reference/datetime/datetimeimmutable/createfromtimestamp.xml new file mode 100644 index 0000000000..62a6ee83cb --- /dev/null +++ b/reference/datetime/datetimeimmutable/createfromtimestamp.xml @@ -0,0 +1,95 @@ + + + + + + DateTimeImmutable::createFromTimestamp + Unix タイムスタンプからインスタンスを生成する + + + + &reftitle.description; + + public static staticDateTimeImmutable::createFromTimestamp + intfloattimestamp + + + + Unix タイムスタンプからインスタンスを生成します。 + + + + + &reftitle.parameters; + + + + timestamp + + + 日付を表す Unix タイムスタンプ。 + &float; の値も受け付けるため、マイクロ秒の精度を指定できます。 + + + + + + + + + &reftitle.returnvalues; + + 新しい DateTimeImmutable インスタンスを返します。 + + + + + &reftitle.errors; + + timestamp が [PHP_INT_MIN, PHP_INT_MAX] の範囲外の場合、 + DateRangeError がスローされます。 + + + + + &reftitle.examples; + + <methodname>DateTimeImmutable::createFromTimestamp</methodname> の例 + +format('Y-m-d H:i:s.u'); +?> +]]> + + &example.outputs; + + + + + + + + \ No newline at end of file diff --git a/reference/datetime/datetimeimmutable/modify.xml b/reference/datetime/datetimeimmutable/modify.xml index 36643cb3e9..eb301c21e2 100644 --- a/reference/datetime/datetimeimmutable/modify.xml +++ b/reference/datetime/datetimeimmutable/modify.xml @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::modify() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::modify stringmodifier @@ -62,6 +62,14 @@ + + 8.4.0 + + 仮の戻り値の型が、DateTimeImmutable になりました。 + これより前のバージョンでは、 + DateTimeImmutablefalse でした。 + + 8.3.0 diff --git a/reference/datetime/datetimeimmutable/setdate.xml b/reference/datetime/datetimeimmutable/setdate.xml index cc7efb784f..fdb6c97235 100644 --- a/reference/datetime/datetimeimmutable/setdate.xml +++ b/reference/datetime/datetimeimmutable/setdate.xml @@ -1,6 +1,6 @@ - + @@ -11,7 +11,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::setDate() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::setDate intyear intmonth diff --git a/reference/datetime/datetimeimmutable/setisodate.xml b/reference/datetime/datetimeimmutable/setisodate.xml index 1f1ae3b17d..e454c3c815 100644 --- a/reference/datetime/datetimeimmutable/setisodate.xml +++ b/reference/datetime/datetimeimmutable/setisodate.xml @@ -1,6 +1,6 @@ - + @@ -11,7 +11,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::setISODate() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::setISODate intyear intweek diff --git a/reference/datetime/datetimeimmutable/setmicrosecond.xml b/reference/datetime/datetimeimmutable/setmicrosecond.xml new file mode 100644 index 0000000000..a5fdd20bb1 --- /dev/null +++ b/reference/datetime/datetimeimmutable/setmicrosecond.xml @@ -0,0 +1,106 @@ + + + + + + DateTimeImmutable::setMicrosecond + 時刻のマイクロ秒部分を設定する + + + + &reftitle.description; + + #[\NoDiscard(message: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")] + public staticDateTimeImmutable::setMicrosecond + intmicrosecond + + + + 元のオブジェクトを基にマイクロ秒部分を変更した、 + 新しい DateTimeImmutable オブジェクトを返します。 + + + + + &reftitle.parameters; + + + + microsecond + + + 設定するマイクロ秒の値 (0 から 999999)。 + + + + + + + + + &reftitle.returnvalues; + + &date.datetimeimmutable.return.modifiedobject; + + + + + &reftitle.errors; + + microsecond が [0, 999999] + の範囲外の場合、DateRangeError がスローされます。 + + + + + &reftitle.examples; + + <methodname>DateTimeImmutable::setMicrosecond</methodname> の例 + +format('Y-m-d H:i:s.u') . PHP_EOL; +$date = $date->setMicrosecond(987654); +echo $date->format('Y-m-d H:i:s.u') . PHP_EOL; +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + DateTimeInterface::getMicrosecond + + + + + diff --git a/reference/datetime/datetimeimmutable/settime.xml b/reference/datetime/datetimeimmutable/settime.xml index 02b7896c0c..1d512f1899 100644 --- a/reference/datetime/datetimeimmutable/settime.xml +++ b/reference/datetime/datetimeimmutable/settime.xml @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::setTime() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::setTime inthour intminute diff --git a/reference/datetime/datetimeimmutable/settimestamp.xml b/reference/datetime/datetimeimmutable/settimestamp.xml index 03fdeb6da2..cd86da8bcf 100644 --- a/reference/datetime/datetimeimmutable/settimestamp.xml +++ b/reference/datetime/datetimeimmutable/settimestamp.xml @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::setTimestamp inttimestamp @@ -75,6 +75,7 @@ echo $newDate->format('U = Y-m-d H:i:s') . "\n"; &reftitle.seealso; DateTimeImmutable::getTimestamp + DateTimeImmutable::setMicrosecond diff --git a/reference/datetime/datetimeimmutable/settimezone.xml b/reference/datetime/datetimeimmutable/settimezone.xml index 25accce334..69f120177f 100644 --- a/reference/datetime/datetimeimmutable/settimezone.xml +++ b/reference/datetime/datetimeimmutable/settimezone.xml @@ -1,6 +1,6 @@ - + @@ -11,7 +11,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::setTimezone() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::setTimezone DateTimeZonetimezone diff --git a/reference/datetime/datetimeimmutable/sub.xml b/reference/datetime/datetimeimmutable/sub.xml index c1c1d14b02..af4402999d 100644 --- a/reference/datetime/datetimeimmutable/sub.xml +++ b/reference/datetime/datetimeimmutable/sub.xml @@ -1,6 +1,6 @@ - + @@ -13,7 +13,7 @@ &reftitle.description; - #[\NoDiscard] + #[\NoDiscard(message: "as DateTimeImmutable::sub() does not modify the object itself")] public DateTimeImmutableDateTimeImmutable::sub DateIntervalinterval diff --git a/reference/datetime/datetimeinterface/getmicrosecond.xml b/reference/datetime/datetimeinterface/getmicrosecond.xml new file mode 100644 index 0000000000..afa1ac798d --- /dev/null +++ b/reference/datetime/datetimeinterface/getmicrosecond.xml @@ -0,0 +1,94 @@ + + + + + + DateTimeInterface::getMicrosecond + DateTimeImmutable::getMicrosecond + DateTime::getMicrosecond + Unix タイムスタンプのマイクロ秒部分を取得する + + + + &reftitle.description; + + public intDateTimeInterface::getMicrosecond + + + + public intDateTimeImmutable::getMicrosecond + + + + public intDateTime::getMicrosecond + + + + Unix タイムスタンプのマイクロ秒部分を取得します。 + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + その日付をあらわす Unix タイムスタンプのマイクロ秒部分を返します。 + + + + + &reftitle.examples; + + <methodname>DateTimeInterface::getMicrosecond</methodname> の例 + +format('u')); +var_dump($date->getMicrosecond()); +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + DateTimeInterface::getTimestamp + DateTimeInterface::format + + + + + diff --git a/reference/datetime/datetimeinterface/gettimestamp.xml b/reference/datetime/datetimeinterface/gettimestamp.xml index abab418b77..e161543f3a 100644 --- a/reference/datetime/datetimeinterface/gettimestamp.xml +++ b/reference/datetime/datetimeinterface/gettimestamp.xml @@ -1,6 +1,6 @@ - + @@ -157,6 +157,7 @@ echo $milli, "\n", $micro, "\n"; DateTime::setTimestamp DateTimeImmutable::setTimestamp DateTimeInterface::format + DateTimeInterface::getMicrosecond