0

How to change the date using date command along with changing the time zone. Since "IST" as time zone is not setting to Indian standard time (which is UTC +05:30) (I am looking for a solution specific to CentOS 7 )

  • Please mention distro and version in body to get precise answer specific to your issue. – Nikhil_CV Mar 15 '18 at 7:47
0

In most Unices, the system clock should be set to UTC time. The timezone should then be set to the appropriate value by either setting the TZ environment variable to a value such as Asia/Calcutta (on a user-by-user basis), or by setting the system's timezone. The date command is not used for setting the timezone.

Setting the system's timezone may be done differently on different Unices. On Ubuntu, it is done through the command dpkg-reconfigure tzdata. On OpenBSD it is done by creating a symbolic link from /etc/localtime to the correct timezone file under /usr/share/zoneinfo (e.g. /etc/localtime -> /usr/share/zoneinfo/Asia/Calcutta).

0

When setting the date with date, it changes the time stored by the system RTC, which does not store timezone information. It's up to the OS to interpret the RTC time as being in some timezone or the other. Linux typically assumes the RTC time is in UTC, Windows typically assumes it's in the local timezone. So, when setting the time in Linux, if you give it time in IST, it will usually convert it to UTC and then store the UTC timestamp in the RTC.

In short: date is the wrong command for setting the timezone. The appropriate command would likely depend on which specific OS or distribution you are using. See, for example: How to change the timezone on CentOS 7?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.