chdate command
Purpose
Displays or changes the date, time or time zone.
Syntax
chdate [ mmddHHMM [YYyy | yy] ] [-timezone TZ]
chdate [-year YYyy] [-month mm] [-day dd] [-hour HH] [-minute MM] [-timezone TZ]
Description
Displays or changes the system date, time, or time zone. Changes made to the time zone will not take effect until the user logs out. For the time zone to take effect for the entire system, the system must be rebooted. All flags are optional, and the current system time information will be used if a flag was unspecified.
If no flags or arguments are specified, the chdate command displays the current date and time.
The mmddHHMM [YYyy | yy] parameters correspond to month, day, hour, minute, and optional 4 or 2 digit year.
Note: If you do not specify the first 2 digits of the year,
values in the range 70 - 99 refer to the twentieth century and values
in the range 00 - 37 refer to the twenty-first century. If a 4-digit
year is specified, the chdate command attempts
to set the year to YYyy and fails for the values that are out
of range (less than 1970 and greater than 2105). For years in the
range 2038 - 2105, specify the year in the yyyy format.
Note: The
user must have padmin authority to change the date and time.
Flags
Flag name | Description |
---|---|
-year | Sets the year to YYyy. |
-month | Sets the month to mm. |
-day | Sets the day to dd. |
-hour | Sets the hour to HH in 24-hour format. |
-minute | Sets the minute to MM. |
-timezone | Sets the time zone (for example, CST6CDT). |
Exit Status
Examples
- To display the current date and time, type:
chdate
- To change the date to Tue Oct 12 16:30:00 CDT 2004 for a system
in the US Central time zone, type:
orchdate -day 12 -month 10 -year 2004 -hour 16 -minute 30
chdate 101216302004
Note: The user must have padmin authority to change the
date and time.