Changing host timezone from script (HCI)

NicolaZ Lv1Posted 2023-Apr-17 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 596 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 2023-Apr-19 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 2023-Apr-24 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 2023-Apr-24 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 2023-Apr-24 12:11
  
Yes there were API that you can use
Naomi Posted 2023-Apr-24 12:59
  
One commonly used API for this purpose is the "tzdata" library
Adonis001 Lv3Posted 2023-Apr-24 13:04
  
Yes there are a lot of APIs that can interact with timezones
flirene_94 Lv1Posted 2023-Apr-24 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 2023-Apr-24 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 2023-Apr-24 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
1
0

Started Topics

Followers

Follow

11
8
5

Started Topics

Followers

Follow

3
14
3

Started Topics

Followers

Follow

2
2
0

Started Topics

Followers

Follow

Board Leaders