Timezone in date?

喜欢而已 提交于 2019-12-22 08:29:47

问题


From where does the date command in Linux get the timezone information? I cannot see /etc/localtime file and /usr/share/zoneinfo direcory in my system. Still when i execute the date command i get the following output

Thu Dec 9 16:28:18 UTC 2010

Kindly tell me from where does the command get the timezone information?

Thanks, LinuxPenseur


回答1:


Don't forget that UTC is how standard Unix systems store the date/time in the real time clock. You have to jump through hoops using funny programs (see the hwclock(8) manpage) if you dual-boot to Windows, which prefers the local time to be stored in the CMOS real time clock.

So the date(1) program is simply showing you the results of "I have no configured time zone":

# date -u
Thu Dec  9 10:40:54 UTC 2010
# TZ=UTC date
Thu Dec  9 10:40:57 UTC 2010
# TZ=PST8PDT date
Thu Dec  9 02:41:02 PST 2010
#



回答2:


From http://www.wikihow.com/Change-the-Timezone-in-Linux

On mobile phones and other small devices that run Linux, the time zone is stored differently. It is written in /etc/TZ, in the format that is described, for instance, in [4] . Edit this file manually or use echo (for instance, echo GMT0BST > /etc/TZ to set the the timezone of the United Kingdom).

From http://www.radisys.com/files/support_downloads/03245-02_MPCMM0001_MPCMM0002_CMM_Software_TPS.pdf

The CMM determines the offset to local timezone maintained in file /etc/cmm/TZ and automatically updates the time.




回答3:


This should help :

http://www.hypexr.org/linux_date_time_help.php



来源:https://stackoverflow.com/questions/4396575/timezone-in-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!