Differences between revisions 3 and 4
Revision 3 as of 2020-11-11 15:24:25
Size: 1058
Comment:
Revision 4 as of 2020-11-11 15:38:52
Size: 1258
Comment:
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
Use '''`timedatectl(1)`''' to set the local timezone. For `systemd`-capable systems, use '''`timedatectl(1)`''' to set the local timezone. Substitute `America/New_York` with your preferred configuration.
Line 21: Line 21:
timedatectl set-timezone ZONE/SUBZONE timedatectl set-timezone America/New_York
Line 29: Line 29:
ln -sf /usr/share/zoneinfo/Zone/SubZone /etc/localtime # apply a new setting ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
}}}

Some utilities will also respect a `TZ` environment variable.

{{{
export TZ=America/New_York
date
Line 36: Line 43:
== Date == == Date and Time ==

System Clock in Linux

The system clock in Linux generally uses the Coordinated Universal Time (UTC) standard, as opposed to localtime.

Linux images often come with a wonky clock setting based on when the image was generated. This can cause significant issues on web servers, as signed SSL certificates are only valid within a date range.


Timezone

For systemd-capable systems, use timedatectl(1) to set the local timezone. Substitute America/New_York with your preferred configuration.

timedatectl status
timedatectl list-timezones
timedatectl set-timezone America/New_York

timedatectl(1) is a simple utility script; the manual equivalents roughly are...

realpath /etc/localtime
ls /usr/share/zoneinfo/*
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Some utilities will also respect a TZ environment variable.

export TZ=America/New_York
date


Date and Time

Use date(1) to set the current datetime. Note that date(1) must be called by the root user to set a datetime.

# January 1st, 2020 at 12:30
sudo date 2001011230


CategoryRicottone

Linux/Clock (last edited 2023-06-29 17:16:15 by DominicRicottone)