程式中添加時間的初始化語句:“date_default_timezone_set("asia/shanghai");
定義和用法
the date_default_timezone_set() function sets the default timezone used by all date/time functions.
date_default_timezone_set()函數的作用是:設定用於一個指令碼中所有日期時間函數的預設時區。
syntax
文法
date_default_timezone_set(timezone) |
parameter 參數 |
description 描述 |
| timezone |
required. the timezone identifier, like "utc" or "europe/paris". list of valid timezones: http://www.php教程.net/manual/en/timezones.php 必要參數,時區確認器,如“utc”或“europe/paris”。下面列出了有效時區:http://www.php.net/manual/en/timezones.php |
tips教程 and notes
注意點
note: this function always returns true (even if the timezone parameter isn't valid).
注意:這個函數總是返回true(即使時區參數無效的情況下)。
example
案例
the output of the code above will be:
上述代碼將輸出下面的結果:
http://www.bkjia.com/PHPjc/632328.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632328.htmlTechArticle程式中添加時間的初始化語句:date_default_timezone_set(asia/shanghai); 定義和用法 the date_default_timezone_set() function sets the default timezone used by all d...