日期/时间
PHP Manual

The DatePeriod class

(PHP 5 >= 5.3.0, PHP 7)

简介

Represents a date period.

A date period allows iteration over a set of dates and times, recurring at regular intervals, over a given period.

类摘要

DatePeriod implements Traversable {
/* 常量 */
const integer EXCLUDE_START_DATE = 1 ;
/* 属性 */
public integer $recurrences ;
public boolean $include_start_date ;
/* 方法 */
public __construct ( DateTimeInterface $start , DateInterval $interval , int $recurrences [, int $options ] )
public __construct ( DateTimeInterface $start , DateInterval $interval , DateTimeInterface $end [, int $options ] )
public __construct ( string $isostr [, int $options ] )
public DateInterval getDateInterval ( void )
public DateTimeInterface getEndDate ( void )
public DateTimeInterface getStartDate ( void )
}

预定义常量

DatePeriod::EXCLUDE_START_DATE

Exclude start date, used in DatePeriod::__construct().

属性

recurrences

The number of recurrences.

include_start_date

Whether to include the start date in the set of recurring dates or not.

start

The start date of the period.

current

During iteration this will contain the current date within the period.

end

The end date of the period.

interval

An ISO 8601 repeating interval specification.

更新日志

版本 说明
5.3.27, 5.4.17 The public properties recurrences, include_start_date, start, current, end and interval have been exposed.

Table of Contents


日期/时间
PHP Manual