downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DatePeriod::__construct> <DateInterval::format
Last updated: Fri, 11 Dec 2009

view this page in

The DatePeriod class

Introduction

Representation of date period.

Class synopsis

DatePeriod
DatePeriod implements Traversable {
/* Constants */
const integer DatePeriod::EXCLUDE_START_DATE = 1 ;
/* Methods */
__construct ( DateTime $start , DateInterval $interval , int $recurrences [, int $options ] )
}

Predefined Constants

DatePeriod Node Types

DatePeriod::EXCLUDE_START_DATE

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

Table of Contents



add a note add a note User Contributed Notes
DatePeriod
jkaatz at gmx dot de
10-Jul-2009 08:55
Nice example from PHP Spring Conference (thanks to Johannes Schlüter and David Zülke)

<?php
$begin
= new DateTime( '2007-12-31' );
$end = new DateTime( '2009-12-31 23:59:59' );

$interval = DateInterval::createFromDateString('last thursday of next month');
$period = new DatePeriod($begin, $interval, $end, DatePeriod::EXCLUDE_START_DATE);

foreach (
$period as $dt )
  echo
$dt->format( "l Y-m-d H:i:s\n" );
?>

DateInterval specs could be found at http://en.wikipedia.org/wiki/ISO_8601#Time_intervals

DatePeriod::__construct> <DateInterval::format
Last updated: Fri, 11 Dec 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites