Home > php教程 > PHP源码 > php Get the day of the week that today or a certain date is

php Get the day of the week that today or a certain date is

大家讲道理
Release: 2016-11-08 14:06:27
Original
1333 people have browsed it

<?php
function getWeekName($data,$format = &#39;星期&#39;)
{
    $week   =  date( "D ",$data);
    switch($week)
    {
        case "Mon ":
            $current   =   $format."一";
            break;
        case "Tue ":
            $current   =   $format."二";
            break;
        case "Wed ":
            $current   =   $format."三";
            break;
        case "Thu ":
            $current   =   $format."四";
            break;
        case "Fri ":
            $current   =   $format."五";
            break;
        case "Sat ":
            $current   =   $format."六";
            break;
        case "Sun ":
            $current   =   $format."日";
            break;
    }
    return $current;
}
 
echo &#39;今天是:&#39;.getWeekName(time(),&#39;星期&#39;);
echo &#39;<br>&#39;;
echo &#39;今天是:&#39;.getWeekName(time(),&#39;礼拜&#39;);
echo &#39;<br>&#39;;
echo &#39;2010-12-12是:&#39;.getWeekName(strtotime(&#39;2010-12-12&#39;),&#39;礼拜&#39;);
?>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template