Monday, June 30, 2014

Setting up Date and time on Redhat Linux EP 7

Setting up Date and time on Redhat EP 7
Changing the Date
# timedatectl set-time YYYY-MM-DD
# timedatectl set-time 2014-06-30
YYYY -: four-digit year
MM -: two-digit month
DD -: two-digit day of the month.

Changing the Time
# timedatectl set-time HH:MM:SS
# timedatectl set-time 10:15:00
HH -: hour, 24 hour cycle.
MM -: minute
SS -: second
To check the time information just type the command,
# timedatectl
Changing the Time Zone
List available time zones.
# timedatectl list-timezones | grep -i europe
Change your time zone.
# timedatectl set-timezone Your_time_zone
# timedatectl set-timezone Europe/Amsterdam

Setting up time with time server
# timedatectl set-ntp boolean (yes/no)
# timedatectl set-ntp yes

Using the date command.
To display current date and time.
# date
To customize the date output
# date +"%Y-%m-%d %H:%M"
2014-06-30 14:26
Change the current date (June 30, 2014)
# date +%F -s YYYY-MM-DD
# date +%F -s 2014-06-30
Change the current time
# date +%T -s HH:MM:SS
# date +%T --set 14:30:40
Note: By default date command sets the system clock in local time. To set it on UTC use the following command.
# date +%T --set HH:MM:SS --utc

Using hardware (hwclock) clock.
# hwclock --set --date "dd mmm yyyy HH:MM"
# hwclock --set --date " 06 jun 2014 31:22"
# hwclock --systohc

No comments:

Post a Comment