Home >Backend Development >PHP Tutorial >PHP格式化输出时间和星期

PHP格式化输出时间和星期

WBOY
WBOYOriginal
2016-06-23 13:05:471216browse

  echo "今天是 ".date("Y")."年 ".date("m")."月 ".date("d")."日 ".date("H:i:s").datetime();

  function datetime(){

    $a=date("N");

    switch ($a){

        case 7:

        return " 星期天";

        break;

        case 1:

        return " 星期一";

        break;

        case 2:

        return " 星期二";

        break;

        case 3:

        return " 星期三";

        break;

        case 4:

        return " 星期四";

        break;

        case 5:

        return " 星期五";

        break;

        case 6:

        return " 星期六";

        break;

    }

  }

?>

Statement:
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