Skip to content

cPeriod::__construct()

Rainer Stötter edited this page Apr 28, 2017 · 14 revisions

Method __construct( )

 public   \libdatephp\cPeriod libdatephp\cPeriod::__construct(mixed $a, mixed $b, integer $c, integer $d, integer $e, integer $f)

The constructor for the cPeriod class

$p = new cPeriod( 11, 22, 2016, 11, 23, 2016 ); from month, day, year, month, day, year

$p = new cPeriod( ); a period with today as start and length one day

$dtm = new cPeriod( new cDate( 11, 22, 2016 ) ); one day long period with the date as starting date

$dtm = new cPeriod( new cDate( 11, 22, 2016 ), 20 ); 20 days from the date as starting date

$dtm = new cPeriod( 20516, 30517 ); from two timestamps

$dtm = new cPeriod( new cDate( 11, 22, 2016 ), new cDate( 11, 25, 2016 ) ); from two dates

$dtm = new cPeriod( 11, 23, 2016 ); from a date

$dtm = new cPeriod( 11, 23, 2016, 20 ); 20 days from a date

Arguments

  • $a mixed - <p>can be an int as month or a timestamp or a cDate</p>
  • $b mixed - <p>can be a date or an int as day or a cDate</p>
  • $c integer - <p>the year of the first date</p>
  • $d integer - <p>the month of the ending date</p>
  • $e integer - <p>the day of the ending date</p>
  • $f integer - <p>the year of the ending date</p>

Returns

\libdatephp\cPeriod 

Clone this wiki locally