Learning Debian GNU/LinuxBy Bill McCarty
1st Edition September 1999
1-56592-705-2, Order Number: 7052
360 pages, $34.95 , Includes CD-ROM
Linux provides commands that let you set the current system date and time and the system time zone.
To display the current system time, enter the date command:debian:~# date Fri Jul 30 02:28:22 PDT 1999
To set the current system time, use the following form of the
datecommand:date MMDDhhmm[ CC] YY[. ss]
The parts of the command argument have the following meanings:
A two-digit month, 01-12.
A two-digit day of month, 01-31.
A two-digit hour, 00-24.
A two-digit minute, 00-59.
An optional two-digit century; for example, 19 or 20.
A two-digit year; for example, 99 or 00.
An optional two-digit second, 00-59.
The command displays the time you enter and then sets the system time:debian:~# date 073010411999 Fri Jul 30 10:41:00 PDT 1999
When you power down or reboot your system, the system date and time will revert to the values held in non-volatile (CMOS) memory. To store the Linux date and time in CMOS, issue the following command:hwclock --systohc
If you set your clock to UTC rather than local time, issue the command:hwclock --systohc --utc
To set the time zone, use the tzconfig command. The command initiates a dialog that displays the current time zone and asks if you want to change it. If you reply yes, the command prompts you to choose from a list of geographical areas and then cities. Based on your choices, the command sets and displays the current time zone. A typical dialog resembles the following:debian:~#
tzconfigYour current time zone is set to US/Pacific Do you want to change that? [n]:
yPlease enter the number of the geographic area in which you live: 1) Africa 7) Australia 2) America 8) Europe 3) US time zones 9) Indian Ocean 4) Canada time zones 10) Pacific Ocean 5) Asia 11) Use System V style time zones 6) Atlantic Ocean 12) None of the above Then you will be shown a list of cities which represent the time zone in which they are located. You should choose a city in your time zone. Number:
2Adak Anchorage Anguilla Antigua Araguaina Aruba Asuncion Atka Barbados Belem Belize Bogota Boise Buenos_Aires Cancun Caracas Catamarca Cayenne Cayman Chicago Chihuahua Cordoba Costa_Rica Cuiaba Curacao Dawson Dawson_Creek Denver Detroit Dominica Edmonton El_Salvador Ensenada Fort_Wayne Fortaleza Glace_Bay Godthab Goose_Bay Grand_Turk Grenada Guadeloupe Guatemala Guayaquil Guyana Halifax Havana Indiana/Indianapolis Indiana/Knox Indiana/Marengo Indiana/Vevay Indianapolis Inuvik Iqaluit Jamaica Jujuy Juneau Knox_IN La_Paz Lima Los_Angeles Louisville Maceio Managua Manaus Martinique Mazatlan Mendoza Menominee Mexico_City Miquelon Montevideo Montreal Montserrat Nassau New_York Nipigon Nome Noronha Panama Pangnirtung Paramaribo Phoenix Port-au-Prince Port_of_Spain Porto_Acre Porto_Velho Puerto_Rico Rainy_River Rankin_Inlet Regina Rosario Santiago Santo_Domingo Sao_Paulo Scoresbysund Shiprock St_Johns St_Kitts St_Lucia St_Thomas St_Vincent Swift_Current Tegucigalpa Thule Thunder_Bay Tijuana Tortola Vancouver Virgin Whitehorse Winnipeg Yakutat Yellowknife Please enter the name of one of these cities or zones You just need to type enough letters to resolve ambiguities Press Enter to view all of them again Name :
Los_AngelesYour default time zone is set to 'America/Los_Angeles'. Local time is now: Fri Jul 30 02:26:32 PDT 1999. Universal Time is now: Fri Jul 30 09:26:32 UTC 1999.
Back to: Learning Debian GNU/Linux
© 2001, O'Reilly & Associates, Inc.