|
-
Nov 18th, 2022, 06:24 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to get a TimeZone, its UTC offset in TimeSpan format?
Hi, Consider you have a clock control which works on GMT and has a UTC offset parameter in shh:mm:ss (System.TimeSpan) format. You also have a Combobox1 which contains all possible timezones via
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.AddRange(TimeZoneInfo.GetSystemTimeZones.ToArray)
End Sub
The goal is when you change the ComboBox1 index/item clock automatically converts the time.
Please note that Combobox may return something like "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna" but we only require its +01:00:00 (TimSpan).
(I am ParseExact and FormatProvider noob, sorry)
Sincerely,
Pourkascheff/.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|