DatePeriod 클래스
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
소개
날짜 기간을 나타냅니다.
날짜 기간을 사용하면 지정된 기간 동안 일정한 간격으로 반복되는 날짜 및 시간 세트를 반복할 수 있습니다.
클래스 개요
class DatePeriod implements IteratorAggregate {
/* Constants */
const int EXCLUDE_START_DATE = 1;
/* Properties */
public int $recurrences;
public bool $include_start_date;
public DateTimeInterface $start;
public DateTimeInterface $current;
public DateTimeInterface $end;
public DateInterval $interval;
/* Methods */
public __construct(
DateTimeInterface $start,
DateInterval $interval,
int $recurrences,
int $options = 0
)
public __construct(
DateTimeInterface $start,
DateInterval $interval,
DateTimeInterface $end,
int $options = 0
)
public __construct(string $isostr, int $options = 0)
public getDateInterval(): DateInterval
public getEndDate(): ?DateTimeInterface
public getRecurrences(): ?int
public getStartDate(): DateTimeInterface
}
미리 정의된 상수
DatePeriod::EXCLUDE_START_DATE
- DatePeriod::__construct()에서 사용되는 시작 날짜를 제외합니다.
Properties
- recurrences
- DatePeriod 인스턴스가
$recurrences
를 명시적으로 전달하여 생성된 경우 반복 횟수입니다. DatePeriod::getRecurrences()도 참조하십시오. - include_start_date
- 반복 날짜 집합에 시작 날짜를 포함할지 여부입니다.
- start
- 기간의 시작 날짜입니다.
- current
- 반복하는 동안 기간 내의 현재 날짜가 포함됩니다.
- end
- 기간의 종료 날짜입니다.
- interval
- ISO 8601 반복 간격 사양입니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | DatePeriod는 이제 IteratorAggregate를 구현합니다. 이전에는 Traversable이 대신 구현되었습니다. |
목차
- DatePeriod::__construct — 새 DatePeriod 개체를 만듭니다.
- DatePeriod::getDateInterval — 간격을 가져옵니다.
- DatePeriod::getEndDate — 종료 날짜를 가져옵니다.
- DatePeriod::getRecurrences — 반복 횟수를 가져옵니다.
- DatePeriod::getStartDate — 시작 날짜를 가져옵니다