Changing host timezone from script (HCI)

NicolaZ Lv1Posted 17 Apr 2023 22:43

Last edited by NicolaZ 17 Apr 2023 22:45.

Hello,
we've been having problems with our host's time. Every now and then the timezone changes and the clock of all the VMs goes back by one hour.
I would like to automize the process of setting the host clock correctly with a script so that we don't need to access the HCI and manually do it everytime.
Is there a way to interact with the timezone settings from code? Maybe some APIs?
Thanks

By solving this question, you may help 512 user(s).

Posting a reply earns you 2 coins. An accepted reply earns you 20 coins and another 10 coins for replying within 10 minutes. (Expired) What is Coin?

Enter your mobile phone number and company name for better service. Go

Faisal Piliang Posted 19 Apr 2023 23:52
  
Hi,
1. ISO_8601 which is string (text) representation for dates Ex. 2021-06-3T17:55:02+0000
2. Epoch time is the number representation for dates. Ex 1623606902 This is the calculation of the seconds that has been spent from 1 January 1970. It depends that where you should use ISO and where you should use epoch, it says epoch is more suitable for IoT applications while ISO is preferable for other day-to-day applications because of human readability and so on.
Pat Lv4Posted 24 Apr 2023 11:53
  
Yes, there are several ways to interact with the timezone settings from code on Linux. One common method is to use the "timedatectl" command, which is part of the systemd system management suite. "timedatectl" allows you to view and modify the system clock and timezone settings.

RegiBoy Lv5Posted 24 Apr 2023 12:03
  
Yes, there are APIs that you can use to interact with the timezone settings on a host and automate the process of setting the host clock correctly.

One commonly used API for this purpose is the "tzdata" library, which is used by many Linux distributions to manage timezone data. You can use this library to read and set the system timezone from a script or application.
MISMIS Lv3Posted 24 Apr 2023 12:11
  
Yes there were API that you can use
Naomi Lv3Posted 24 Apr 2023 12:59
  
One commonly used API for this purpose is the "tzdata" library
Adonis001 Lv3Posted 24 Apr 2023 13:04
  
Yes there are a lot of APIs that can interact with timezones
flirene_94 Lv1Posted 24 Apr 2023 13:09
  
There are different ways to automate the process of setting the host clock correctly, depending on the operating system and the type of device you're working with.
isabelita Lv3Posted 24 Apr 2023 13:12
  
Depending on the operating system and the kind of device, there are several ways to automate the process of appropriately establishing the host clock.
BitCloud Lv3Posted 24 Apr 2023 13:17
  
Yes, there are numerous ways to interface with timezone settings in Linux code. One popular technique is to utilize the systemd system management suite's "timedatectl" command. "timedatectl" displays and modifies the system clock and timezone settings.

I Can Help:

Change

Moderator on This Board

2
20
0

Started Topics

Followers

Follow

Board Leaders