First of all, you can check the time and date using the date command in Linux. how to set or change date and time using timezone file location in Linux.
How To Set Date In Linux Using Command Line:
This is set to India standard time and date format is date +%Y%m%d
date +%Y%m%d -s '20200212'
Set the time with format date +%T -s ‘HH:MM:SS’
date +%T -s '14:20:00'
you can also set date and time using the below command as well. date -s '19 January 2020 14:11:00'
If you want to change your region, you can find this file on the server at this location /usr/share/zoneinfo
You can right the timezone for you according to your location or needs. You will have to remove this file localtime from /etc/localtime. If you require to change it to another region.
rm -rf /etc/locatime ln -s /usr/share/zoneinfo/America/Chicago /etc/locatime
Else, you can also use copy command instead of above command.so
cp /usr/share/zoneinfo/America/Chicago /etc/locatime
There’s a hardware clock that runs in your hardware even you’re disconnected from the power supply. so
You can set hwclock to your localtime. so
hwclock --set --date='2020-04-12 15:45:05' --localtime
Set it to UTC time. so
hwclock --set --date='2020-04-12 15:45:05' --utc
You’re done linux change timezone file location set date and time how to