PHP 8.3.4 Released!

DatePeriod::getStartDate

(PHP 5 >= 5.6.5, PHP 7, PHP 8)

DatePeriod::getStartDate 開始日を取得する

説明

オブジェクト指向型

public DatePeriod::getStartDate(): DateTimeInterface

期間の開始日を取得する。

パラメータ

この関数にはパラメータはありません。

戻り値

DatePeriodDateTimeImmutable objectstart パラメータに用いて初期化されている場合は DateTimeImmutable object を返す。

それ例外の場合は DateTime object を返す。

例1 DatePeriod::getStartDate() の例

<?php
$period
= new DatePeriod('R7/2016-05-16T00:00:00Z/P1D');
$start = $period->getStartDate();
echo
$start->format(DateTime::ISO8601);
?>

上の例の出力は以下となります。

2016-05-16T00:00:00+0000

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top