今天和同事一起讨论了一下时区转换的问题.
执行下面的语句:
TZ=’America/Los_Angeles’ date +”%Y-%m-%d %H” –date=”`TZ=’Asia/Shanghai’ date –date=”2008-10-10 15:00:00″`”
结果:2008-10-10 14
显然是错误的.
直接看一下后面的语句:TZ=’Asia/Shanghai’ date –date=”2008-10-10 15:00:00″
结果:Fri Oct 10 15:00:00 CST 2008
为什么呢?搜了一下,CST代表了很多时区:
CST Central Standard Time (USA) UT-6:00
CST Central Standard Time (Australia) UT+9:30
CST China Standard Time UT+8:00
CST Cuba Standard Time UT-4:00
原来很多系统里面CST都变成了GMT-6,也就是美国中部时间.
然后分别试了一下香港和台湾的时区,也都会被自动转为CST.
最后试了一下新加坡的时区:SGT(Asia/Singapore)
TZ=’America/Los_Angeles’ date +”%Y-%m-%d %H” –date=”`TZ=’Asia/Singapore’ date –date=”2008-10-10 15:00:00″`”
一切OK,
3 Responses
至尊宝
09|10|2008 1非常感谢!
cheerneaponry
13|12|2008 2Hi! Wonderful site! Great job! I want to share some cool info with you where you can get cheap levitra,buying viagra,buying viagra online, buy cialis doctor online, purchase viagra online, viagra for sale without a prescription, buy viagra online,cheapest cialis. Hope this helps. Happy holidays!
FeseBaspSkise
09|1|2009 3Hi! Wonderful site! Great job! I want to share some cool info with you where you can get cheap levitra,buying viagra,buying viagra online, buy cialis doctor online, purchase viagra online, viagra for sale without a prescription, buy viagra online,cheapest cialis. Hope this helps. Happy holidays!
Leave a reply