Of course, PHP's date function is not possible to directly output Chinese date, but you can use this method to write a function of their own.
Code to copy code as follows
function today () {
Date_default_timezone_set ("asia/chongqing");
$a =date ("Y");
$b =date ("M");
$c =date ("D");
$d =date ("G");
$e =date ("I");
$f =date ("s");
return $a. ' Year ' $b. ' Month '. $c. ' Day ' $d. ' Time ' $e. ' $f. ' Seconds ';}
If echo date ("y-m-d") appears;
Alarm:
Warning:date () [function.date]: It is not safe for rely on the system ' s timezone settings. You is *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected ' UTC ' for ' 8.0/no DST ' instead-g:sourcetestceshimktime.php on line 4
Online to check the following information to know the reasons, the following for everyone to share:
in the PHP5.3 The PHP version above, as long as the time involved will be reported a
"PHP warning:date () [function.date]: It is not safe to rely on the system ' s timezone setti Ngs. You is *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected ' UTC ' for ' 8.0/no DST ' instead in
Here are three ways to do it (any one of them):
First, use Date_default_timezone_set () to set Date_default_timezone_set (' PRC ') on the page header; East Eight time zone echo date (' y-m-d h:i:s ');
Second, use Ini_set (' Date.timezone ', ' Asia/shanghai ') in the head of the page;
Third, modify the php.ini. Open Php5.ini Find Date.timezone Remove the previous semicolon modification to become: Date.timezone =PRC
(www.111cn.net)
Restart the HTTP service (such as Apache2 or IIS).
About the Date function parameter
Day of the D month, 2 digits with leading zeros 01 to 31
The day of the D-week, the text says, 3 letters Mon to Sun
Day of the J month, without leading 1 to 31
L (Lowercase letter of "L") Day of the week, full text format Sunday to Saturday
N ISO-8601 format number represents the day of the week (PHP 5.1.0 new Plus) 1 (Monday) to 7 (Sunday)
S English suffix, 2 characters st,nd,rd or th, after the number of days per month. Can be used with J.
The day of the W week, the number represents 0 (Sunday) to 6 (Saturday)
Days 0 to 366 in the Z-year
The week of the year in W ISO-8601 format, starting from Monday (PHP 4.1.0 New) 42 (42nd Week of the year)
F month, full text format, such as January or March January to December
The month represented by the m number, with a leading 1 to 12
M three-letter abbreviation for month Jan to Dec
n number of months, without leading 1 to 12
t the number of days that a given month should be 28 to 31
L is a leap year if the leap year is 1, otherwise 0
o ISO-8601 format year number.
Y 4-digit year full representation for example: 1999 or 2003
Y 2 digits indicate the year for example: 99 or 03
A lowercase morning and afternoon value am or PM
A uppercase morning and afternoon value am or PM
B Swatch Internet Standard 000 to 999
G-hour, 12-hour format, without leading 1 to 12
G-hour, 24-hour format, without leading 00 to 23
H-hour, 12-hour format, with leading 1 to 12
H-hour, 24-hour format, with leading 000 to 23
I have a leading zero minute number 00 to 59>
S number of seconds, with leading 000 to 59>
E Time zone identifier (PHP 5.1.0 new) Example: Utc,gmt,atlantic/azores
I is daylight saving time if daylight saving time is 1, otherwise 0
O hours of difference from GMT for example: +0200
The difference between P and GMT (GMT) is separated by a colon between hours and minutes for example: +02:00
T the time zone where the machine is located
The number of seconds to offset the Z-time difference. The time zone offset in the west of UTC is always negative, and the east of UTC is positive. 43200 to 43200
Date in C ISO 8601 format (PHP 5 new Plus) 2004-02-12t15:19:21+00:00
R RFC 822 Format date For example: Thu, 2000 16:01:07 +0200
The number of seconds since the beginning of the Unix era (January 1 1970 00:00:00 GMT) time () get timestamp
PHP's date () function is very powerful, through the above parameters can achieve a lot of date operation, such as get the above I marked the red parameter description to achieve today is the day of the week operation!
From:http://www.111cn.net/phper/php/53150.htm
PHP date () function output Chinese month day seconds