Use the date command to set your system clock. Use the setclock command to set the time and date for a host on a network. Reset your system clock by either:
The date command displays or sets the date and time. Enter the following command to determine your system's date and time:
/usr/bin/date
Attention: Do not change the date when the system is running with more than one user.
The following formats can be used when setting the date with the Date parameter:
The variables to the Date parameter are defined as follows:
Note: If the yymmdd format is specified, the value of the yy variable must be 88 to 99.
The date command writes the current date and time to standard output if called with no flags or with a flag list that begins with a + (plus sign). Otherwise, it sets the current date. Only a root user can change the date and time. The date command prints out the usage message on any unrecognized flags or input.
If you follow the date command with a + (plus sign) and a field descriptor, you can control the output of the command. You must precede each field descriptor with a % (percent sign). The system replaces the field descriptor with the specified value. Enter a literal % as %% (two percent signs). The date command copies any other characters to the output without change. The date command always ends the string with a new-line character.
-n | Does not set the time globally on all machines in a local area network that have their clocks synchronized. |
-u | Displays or sets the time in Coordinated Universal Time (UTC). |
The setclock command sets the time and date for a host on a network. To determine your system's date and time, enter:
/usr/sbin/setclock
The /usr/sbin/setclock command gets the time from a network time server, and if run by a user with root user authority, sets the local time and date accordingly.
The setclock command takes the first response from the time server, converts the calendar clock reading found there, and shows the local date and time. If the setclock command is run by the root user, it calls the standard workstation entry points to set the system date and time.
If no time server responds, or if the network is not operational, the setclock command displays a message to that effect and leaves the date and time settings unchanged.
Note: Any host running the inetd daemon can act as a time server.
TimeServer | The host name or address of a network host that services TIME requests. The setclock command sends a public network TIME service request to a time server host. If the TimeServer name is omitted, the setclock command sends the request to the default time server. The default time server in a DOMAIN environment is specified by the name server. Otherwise, the default time server is specified in the /etc/hosts file. |