Here is some visual basic code for you!
You receive a ZULU time and want to store it in your local time?
Dim MyZulu As New Date(year,month,day,hr,min,sec,DateTimeKind.Utc)
Dim MyLocal As DateTime = MyZulu.ToLocalTime()
Or is someone or some API asking you for the next format in return, and all you have is a DateTime with your local time in it?
Continue reading Convert between Local Time and UTC or Zulu time
*UTC + offset as (YYYY-MM-DDThh:mm:ss+hh:mm)
Using vmware I always suspend my mac-os machine, so the time at revival is never correct… so how to force a time-synch:
Mojave still uses
ntpdate and the helpers
ntpq are removed. To check and update your system time, you can call
$ sudo sntp -sS pool.ntp.org
sntp firstname.lastname@example.org Tue Mar 21 14:36:42 UTC 2017 (136.200.1~2533)
2018-09-29 19:42:41.448103 (-0200) +1087.742403 +/- 725.183462 pool.ntp.org 18.104.22.168 s2 no-leap
Out of the box, a tracking file is missing. So if you get the error below when checking time:
kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory
create the file and change ownership to
root. Some people reported this was actually breaking the ntp synchronization.
sudo touch /var/db/ntp-kod
sudo chown root:wheel /var/db/ntp-kod
Then run again to check if the error message is gone.
sudo sntp -sS pool.ntp.org
In case you have the same issue, i used to use the following commands before, but they hasn’t worked since whatever previous os version/update:
sudo ntpd -sS time.apple.com
ntpdate -u time.apple.com
Have a nice day!