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.
Contents
Timezone
Use timedatectl(1) to set the local timezone.
timedatectl status timedatectl list-timezones timedatectl set-timezone ZONE/SUBZONE
timedatectl(1) is a simple utility script; the manual equivalents roughly are...
realpath /etc/localtime ls /usr/share/zoneinfo/* ln -sf /usr/share/zoneinfo/Zone/SubZone /etc/localtime # apply a new setting
Date
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