class DatePeriod implements IteratorAggregate (View source)

Representation of date period.

Constants

EXCLUDE_START_DATE

INCLUDE_END_DATE Since: 8.2

Properties

DateTimeInterface $start

Start date

DateTimeInterface|null $current

Current iterator value.

DateTimeInterface|null $end

End date.

DateInterval $interval

The interval

int $recurrences

Number of recurrences.

bool $include_start_date

Start of period.

bool Since: 8.2
$include_end_date

Methods

__construct(string $isostr, int $options = 0)

No description

getDateInterval()

Gets the interval

getEndDate()

Gets the end date

getStartDate()

Gets the start date

static DatePeriod
__set_state(array $array)

No description

void
__wakeup()

No description

int|null
getRecurrences()

Get the number of recurrences

getIterator()

No description

array
__serialize()

No description

void
__unserialize(array $data)

No description

static DatePeriod
createFromISO8601String(string $specification, int $options = 0)

No description

Details

__construct(string $isostr, int $options = 0)

No description

Parameters

string $isostr

String containing the ISO interval.

int $options

Can be set to DatePeriod::EXCLUDE_START_DATE.

Exceptions

DateMalformedPeriodStringException

DateInterval getDateInterval()

Since: 5.6.5

Gets the interval

Return Value

DateInterval

DateTimeInterface|null getEndDate()

Since: 5.6.5

Gets the end date

Return Value

DateTimeInterface|null

DateTimeInterface getStartDate()

Since: 5.6.5

Gets the start date

Return Value

DateTimeInterface

static DatePeriod __set_state(array $array)

No description

Parameters

array $array

Return Value

DatePeriod

void __wakeup()

No description

Return Value

void

int|null getRecurrences()

Since: 7.2.17

Get the number of recurrences

Return Value

int|null

Traversable getIterator()

Since: 8.0

No description

Return Value

Traversable

An instance of an object implementing Iterator or Traversable

array __serialize()

No description

Return Value

array

void __unserialize(array $data)

No description

Parameters

array $data

Return Value

void

static DatePeriod createFromISO8601String(string $specification, int $options = 0)

Since: 8.3

No description

Parameters

string $specification
int $options

Return Value

DatePeriod