PHP shows today is the day of the week with the code for each day of the year
Public Function Getpart ($part) {
$source = $this->timestamp;
Switch ($part)
{
Case ' yy ': $result = intval (Date ("Y", $source)); Break Years
Case ' mm ': $result = intval (Date ("M", $source)); Break Month
Case ' dd ': $result = intval (Date ("D", $source)); Break Day
Case ' W ': $result = intval (Date ("N", $source)); Break Week [1-7] "1" Expression Monday
Case ' CW ': $index = Date ("N", $source); Chinese Week
$week _array = Array (' 1 ' => ' one ', ' 2 ' => ' II ', ' 3 ' => ' III ', ' 4 ' => ' IV ', ' 5 ' => ' V ', ' 6 ' => ' Six ', ' 7 ' => ' Day ');
$result = ' Week '. $week _array[$index];
Break
Case ' h ': $result = intval (Date ("H", $source)); Break When
Case ' m ': $result = intval (Date ("I", $source)); Break Part
Case ' s ': $result = intval (Date ("s", $source)); Break Seconds
Case ' yw ': $result = intval (Date ("W", $source)); Break The first few weeks of the year
Case ' yd ': $result = intval (Date ("Z", $source)); Break The first day of the year
Default://All
$week _array = Array (' 1 ' => ' one ', ' 2 ' => ' II ', ' 3 ' => ' III ', ' 4 ' => ' IV ', ' 5 ' => ' V ', ' 6 ' => ' Six ', ' 7 ' => ' Day ');
$result = Array (
' yy ' => intval (date ("Y", $source)),//year
' mm ' => intval (date ("M", $source)),//month
' DD ' => intval (date ("D", $source)),//day
' W ' => intval (date ("N", $source)),//week [1-7] "1" means Monday
' CW ' => ' Week '. $week _array[date ("N", $source)],//Chinese week
' H ' => intval (date ("H", $source)),//
' m ' => intval (date ("I", $source)),//min
' s ' => intval (date ("s", $source)),//sec
);
Break
}