date date (1) - print or set the system date and time
In this example below, I am showing you some of the ways you can change the system date and time locally . Please understand that in order for the system date to automatically synchronized with accurate date and time, you need to configure your system with Network Time Protocol Daemon (ntpd). The Network Time Protocol Daemon (ntpd), Network Time Protocol Query (ntpq) and other related commands are explained in Chapter 4 under the "Advanced UNIX commands".
Here, I use the date command to find out the date and time.
Saturday, March 12, 2011 08:10:42 PM PST
In order to change the system date and time, I need to have root access, so I become root to run the date command and change the system date and time.
Password:
Oracle Corporation SunOS 5.11 snv_151a November 2010
I use the date command as root to know what is the current system date and time is.
Saturday, March 12, 2011 08:10:48 PM PST
Now, I change the time only to 8:16 pm from 8:10 pm.
Saturday, March 12, 2011 08:16:00 PM PST
Here, I change only the year to 2010.
Friday, March 12, 2010 08:16:00 PM PST
Now, I change the month only to January.
Tuesday, January 12, 2010 08:16:00 PM PST
Here, I change the date to January 1, 2011 for same time.
Saturday, January 1, 2011 08:16:00 PM PST
At this time, I want to change the date and time to correct date that I like to set it which is the below date and time.
Saturday, March 12, 2011 08:17:00 PM PST
Saturday, March 12, 2011 08:17:01 PM PST
Please click on "
Please click on "
man date " to see the Manual Page for this command.