My Xamarin form for iOS and android is heavily use the device time and require to setup using different time in other countries.
I do a search and found this to list all the timezone available:
foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
Console.WriteLine(z.Id);
In my scenario, user can choose any of the sites and set the correct timezone based on where their sites are so the time will be shown relative to their chosen site.
I ran the code and least all the timezone available. Looks like the iOS and android have different presentation of the Timezone Id. I assumed is because of the different system.
I am just worry that the timezone id not fully listed coz our application runs internationally, actually most application run internationally.
var utcTime = DateTime.UtcNow;
var zone = TimeZoneInfo.FindSystemTimeZoneById("Hongkong");
var zoneTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, zone);
System.Diagnostics.Debug.WriteLine("Device Timezone : " + DateTime.Now + " " + TimeZone.CurrentTimeZone.StandardName);
System.Diagnostics.Debug.WriteLine("Hong Kong Time : " + zoneTime.ToString("G"));
Another note: Will the above code taking care of the day light saving as well? e.g. In NZ, each year NZ have to move time forward or background by an hour where other countries are not.