下个php_manual_zh.chm,学习用函数
date() 格式举例<?php
// 假定今天是:March 10th, 2001, 5:16:18 pm
$today = date("F j, Y, g:i a");                 // March 10, 2001, 5:16 pm
$today = date("m.d.y");                         // 03.10.01
$today = date("j, n, Y");                       // 10, 3, 2001
$today = date("Ymd");                           // 20010310
$today = date('h-i-s, j-m-y, it is w Day z ');  // 05-16-17, 10-03-01, 1631 1618 6 Fripm01
$today = date('\i\t \i\s \t\h\e jS \d\a\y.');   // It is the 10th day.
$today = date("D M j G:i:s T Y");               // Sat Mar 10 15:16:08 MST 2001
$today = date('H:m:s \m \i\s\ \m\o\n\t\h');     // 17:03:17 m is month
$today = date("H:i:s");                         // 17:16:17
?>

解决方案 »

  1.   

    楼上那位兄台,请问也就是说:
    echo strftime("%H-%M-%S")
    函数不能实现输出----时:分:秒----对吗?
    如果可以,请您用这个函数输出给我看看好吗?
      

  2.   

    strftime -- 根据区域设置格式化本地时间/日期
    该函数要配合 setlocale() 使用。
    试试:
    <?php
    setlocale(LC_TIME, "C");
    echo strftime("%H-%M-%S");
    ?>  
      

  3.   

    php5么?这个默认的时区是GMT,和北京时间差8个小时date_default_timezone_set函数
      

  4.   

    php.ini 文件中这么设置:
    date.timezone = "asia/shanghai"(默认;date.timezone = )如果没有权限改php.ini,可以在程序最顶部加入这样的代码:
    date_default_timezone_set('PRC')
      

  5.   

    楼上两位说的正确。不过echo strftime("%H-%M-%S")输出时间的方式……让我感觉到稍微奇怪了一些。使用date不好??给我个理由先!