DATE & TIME ZONE

DATE - This command is used to get the information about Day, Current Date,Time,Timezone,Year

• #date

• #date +%D -s YYYY-MM-DD - Changes the date of the system/server (#date +%D -s 2016-04-01)

• #date +%T -s HH:MM:SS - Changes the time on the system/server(#date +%T -s 23:26:00 -u) where "-u" is used if your system clock is set to use UTC

Changing Time Zones

Time zones are used to set time on the servers according to your requirement. There are many methods in practice to change the time zones. One of the easiest way of changing the time zone is as follows -

.#date - Displays the date and current time and time zone and it is UTC currently

.#cd /etc/ - Navigate to the directory /etc

.#rm localtime - Remove the file named "localtime"

.#ls /usr/share/zoneinfo/Asia - Lists all the timezones available in Asia. If you list the folder /usr/share/zoneinfo/, you can see all the Zones available. You can choose the timezone accordingly

.#ln -s /usr/share/zoneinfo/Asia/Calcutta localtime - Link the Calcutta file from Asia directory to file "localtime"

.#date - Displays time from IST timezone and your timezone is changed