Ec (2); php shows the day of the week and the day of the year code publicfunctiongetPart ($ part) {& nbsp; $ source $ this-& gt; timestamp; & nbsp; switch ($ part) & nbsp; {& nbsp; caseyy: $ resultintval (dat script ec (2); script
Php shows the day of the week and day of the year code
Public function getPart ($ part ){
$ Source = $ this-> timestamp;
Switch ($ part)
{
Case 'yy': $ result = intval (date ("Y", $ source); break; // year
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; // The week [1-7] "1" indicates Monday
Case 'cw ': $ index = date ("N", $ source); // Chinese week
$ Week_array = array ('1' => '1', '2' => '2', '3' => '3 ', '4' => '4', '5' => '5', '6' => '6', '7' => 'day ');
$ Result = 'Week'. $ week_array [$ index];
Break;
Case 'H': $ result = intval (date ("h", $ source); break; // hour
Case 'M': $ result = intval (date ("I", $ source); break; // minute
Case's ': $ result = intval (date ("s", $ source); break; // second
Case 'yw': $ result = intval (date ("W", $ source); break; // week of the year
Case 'yd ': $ result = intval (date ("z", $ source); break; // day of the year
Default: // All
$ Week_array = array ('1' => '1', '2' => '2', '3' => '3 ', '4' => '4', '5' => '5', '6' => '6', '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), // The week [1-7] "1" indicates Monday
'Cw '=> 'Week'. $ week_array [date ("N", $ source)], // Chinese week
'H' => intval (date ("h", $ source), // hour
'M' => intval (date ("I", $ source), // minute
'S '=> intval (date ("s", $ source), // second
);
Break;
}