Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Time from Certain Timezone
#2
It's easier in QM3. Or use C# in QM2.

C# code:
// script "Time in a country.cs"

//print.clear();
//foreach (var v in TimeZoneInfo.GetSystemTimeZones()) {
// print.it(v, v.Id);
//}

//Use the above code to discover time zone id. Then use it in code below.

var tz = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
var t = TimeZoneInfo.ConvertTime(DateTime.Now, tz);
osdText.showText($"Time in '{tz.Id}' is {t.TimeOfDay.ToString(@"hh\:mm\:ss")}");

//Another way - use a web service, eg worldtimeapi.org.


Messages In This Thread
Get Time from Certain Timezone - by ken gray - 08-14-2022, 04:59 AM
RE: Get Time from Certain Timezone - by Gintaras - 08-14-2022, 05:27 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)