As a System Administrator is an important Keeping Date and Time up to date on your systems. Most of application running, getting server logs, accessing time, logging time to get accurate timing information to running properly. Also do you need to refer information based on time.
This post have few command to update date and time in your Linux system.
Show current date and timezone:
The date command is helpful to shows your current system time.
Thu Jul 29 18:46:53 IST 2015
Change Time Format:
In Linux, you can change the date and time format:
%Y - Year
%m - Moth
%d - Day
%H - Hour
%M - Minute
Update TimeZone (TZ)Environment Variable :
The following command is use to change TimeZone format, Use TZ variable format require to update.
We have few examples to update system time based on country based,
Asia/Kuala_Lumpur peninsular Malaysia
Asia/Kuching Sabah & Sarawak
How to set timezone to IST:
Wed Jul 29 20:02:10 IST 2015
How to set timezone to MYT:
Wed Jul 29 22:29:59 MYT 2015
How to set timezone to PDT:
Wed Jul 29 07:37:07 PDT 2015
Increase and Decrease Months, Weeks, Minutes.
The below commands are you can (+) increase or (-) decrease date or time by a number of days, weeks, months or years, and seconds,
Wed Jul 29 19:00:06 IST 2015
Wed Jul 29 19:10:11 IST 2015
Wed Jul 29 19:01:25 IST 2015
Wed Aug 12 19:02:17 IST 2015
Wed Jul 29 19:02:32 IST 2015
Sat Aug 29 19:02:56 IST 2015
Wed Jul 29 19:03:02 IST 2015
Sat Sep 12 19:08:06 IST 2015
Wed Jul 29 19:05:13 IST 2015
Hardware clock :
The hwclock command is get and display your hardware system time, date, year, month.
Wed 29 Jul 2015 07:07:58 PM IST -0.739991 seconds