Skip to content

cDate::SetWOY()

Rainer Stötter edited this page May 9, 2017 · 1 revision

Method SetWOY( )

 public   mixed libdatephp\cDate::SetWOY(integer $w, integer $wd)

SetWOY() sets the date to the monday of the $w-th week in the year and searches then the first day of week $wd

week numbers are one-based and start with 1. The first week in the year has the number 1

Example:

use libdatephp;

$dt = new cDate( 11, 23, 2016 );

$dt->SetWOY( 24 );

Example:

$dt = new \libdatephp\cDate( 4, 28, 2017 );
$dt->SetWOY( 1 );
assert( $dt->WOY( ) == 1 );
assert( $dt -> eq( new \libdatephp\cDate( 1,2,2017) ) );
$dt->SetWOY( 18 );
assert( $dt->WOY( ) == 18 );
assert( $dt -> eq( new \libdatephp\cDate( 5,1,2017) ) );
$dt->SetWOY( 19, \libdatephp\cDate::DOW_THURSDAY );
assert( $dt->IsThursday( ) );
assert( $dt->eq( new \libdatephp\cDate( 5,11,2017) ) );

Arguments

  • $w integer - <p>the week number to set</p>
  • $wd integer - <p>the day of week to search. Defaults to DOW_MONDAY</p>

See also

Clone this wiki locally