Effect: Today is: Friday Today is: Friday 2010-12-12 is: Sunday
[PHP] code
- function getWeekName($data,$format = 'week')
- {
- $week = date( "D ",$data);
- switch($week)
- {
- case "Mon ":
- $current = $format."一";
- break;
- case "Tue ":
- $current = $format."二";
- break;
- case "Wed ":
- $current = $format." three";
- break;
- case "Thu ":
- $current = $format."four";
- break;
- case "Fri ":
- $current = $format."five";
- break;
- case "Sat ":
- $current = $format."六";
- break;
- case "Sun ":
- $current = $format."日";
- break;
- }
- return $current;
- }
- echo 'Today It is: '.getWeekName(time(),'week');
- echo '
';
- echo 'Today is: '.getWeekName(time(),'week');
- echo '
';
- echo '2010-12-12 is: '.getWeekName(strtotime('2010-12-12'),'week');
- ?>
Copy code
|