Editing
MediaWiki timezone
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Template:MediaWiki Installation}} MediaWiki預設的時區為[http://zh.wikipedia.org/wiki/UTC UTC](Coordinated Universal Time),跟[http://www.timeanddate.com/worldclock/city.html?n=241 台灣的當地時間]相差8小時(UTC/{{Acronym | acronym= GMT| def=格林威治標準時間(Greenwich Mean Time, GMT)}} +8 hours)。 時區的設定會影響/顯示下列地方 # 「[[Special:Recentchanges | 最近更改]]」的頁面時區、 # 「編輯工具列」的帶有時區的使用者簽名 http://wiki.planetoid.info/skins/common/images/button_sig.png ex: --[[User:Planetoid|Planetoid]] 2008年1月26日 (六) 23:53 ({{Acronym | acronym= CST| def=中原標準時間 (China Standard Time, CST)}}) == 修改預設時區(法1) == 修改LocalSettings.php,在頁尾加入 (#代表註解符號,可自行移除包含#符號到行尾的註解文字) #Set Default Timezone #修正「使用者簽名」的時區 $wgLocaltimezone = "Asia/Taipei"; #修正「最近更改」頁面的時區 $wgLocalTZoffset = +480; #時區偏移的分鐘數(MediaWiki v1.7.0): 台灣時區UTC +8,所以 8小時 * 60(分/小時) = 480分 # $wgLocalTZoffset = 8; #時區偏移的小時數 (MediaWiki v1.7.0 以前的版本) == 修改預設時區(法2) == 修改LocalSettings.php,在頁尾加入 <pre> #Set Default Timezone $wgLocaltimezone = "Asia/Taipei"; #Calculate the timezone offset with UTC $oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); # $wgLocalTZoffset = date("Z") / 3600; # Versions before 1.7.0 used $wgLocalTZoffset as hours. $wgLocalTZoffset = date("Z") / 60; # After 1.7.0 offset as minutes putenv("TZ=$oldtz"); </pre> == 修改預設時區(法3, 不建議) == 由於測試時,導致訪客看到的(1)最近更改頁面的數量(點選最近500次的更動才出現一筆,但帳號登入後數量又變成正常)與(2)編輯介面出現異常,所以不建議採用。 <pre> $wgLocaltimezone = "Asia/Taipei"; $wgDefaultUserOptions = array('timecorrection'=>'08:00' ); </pre> 參考資料 * [http://www.tsima.org.tw/wiki/index.php/%E6%9C%9F%E5%88%8A/MediaWiki%E7%B6%B2%E7%AB%99%E6%9E%B6%E8%A8%AD%E8%A8%AD%E5%AE%9A#.E8.AA.BF.E6.95.B4MediaWiki.E9.A1.AF.E7.A4.BA.E6.99.82.E9.96.93 調整MediaWiki顯示時間] * [http://www.ideagrace.com/club/read.php?tid=1677 Mediawiki的时区设置] * [http://www.mediawiki.org/wiki/Manual:Timezone Manual:Timezone - MediaWiki] * [http://www.mediawiki.org/wiki/Manual:$wgLocaltimezone Manual:$wgLocaltimezone - MediaWiki] * [http://www.mediawiki.org/wiki/Manual:$wgLocalTZoffset Manual:$wgLocalTZoffset - MediaWiki] * [http://www.mediawiki.org/wiki/Manual:$wgDefaultUserOptions Manual:$wgDefaultUserOptions - MediaWiki] 延伸閱讀 * [http://tw.php.net/date PHP: date - Manual] "date("Z") --Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive." 時區偏移的秒數 * [http://www.timeanddate.com/worldclock/ The World Clock - Time Zones] or search the city on the [http://www.timeanddate.com/ homepage] [[Category:MediaWiki]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Acronym
(
edit
)
Template:MediaWiki Installation
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information