Abstract
- A standard to the current date and time at different parts of the world
Read current data and time in python
Read current data and time in POSIX
- The current system timezone info is stored inside
/etc/localtime
Change Timezone
Timezone Code
Refer to this List of timezone codes.
System-level
sudo timedatectl set-timezone <TIMEZONE_CODE>
on POSIX
Process-level
- Install
tzdata
(a time zone database) into the system with a Package Manager and set the timezone withexport TZ=<TIMEZONE_CODE>
- Docker Container is a Process (进程), so setting timezone in this matter is similar to setting a system-level timezone for the application running inside the container
Application-level
- Set it with the corresponding SDK of the language used to code the app
System-level vs Process-level
As you can see changing timezone on a process level doesn’t affect the system-level timezone. And all processes follow the system-level timezone by default.