You want to change your date time system but your machine doesn't have GUI. Don't worry, this tips will show you how to do that.
Because date time is a system part, so you need to have root privileges to do that. Here we go.
Linux Display Current Data and Time
Just type this command and then enter
$ dateSample outputs:
Wed Mar 18 22:38:41 ICT 2015
Linux Display The Hardware Clock (RTC)
Type the following hwclock command to read the Hardware Clock and display the time on screen:
# hwclock -rOr
# hwclock --showOr show it in Coordinated Universal time (UTC):
# hwclock --show --utcSample outputs:
Wed 18 Mar 2015 10:42:59 PM ICT -0.078791 seconds
Linux Set Date Time Command Example
Use the following syntax to set new data and time:
date --set="STRING"For example, set new data to Mar 02 2015 14:30:00, type the following command as root user:
# date -s "Mar 02 2015 14:30:00"Or
# date --set "Mar 02 2015 14:30:00"You can also simplify format using following syntax:
# date +%Y%m%d -s "20150302"
Linux Set Time Only Command Example
To set time use the following syntax:
# date +%T -s "10:13:13"10: Hour (hh)
13: Minute (mm)
13: Second (ss)
Use %p locale's equivalent of either AM or PM, enter:
# date +%T%p -s "6:10:30AM" # date +%T%p -s "12:10:30PM"
References
No comments:
Post a Comment