I'm trying to convert the UTC Time on Server that located overseas to local time e.g. Australia. Could anyone please help me to achieve this
Thanks.
DateTime.ParseExact(s, "yyyyMMdd").ToLocalTime()
The MM needs to be capital, because mm means minutes, not months.
Use DateTime.Parse().
If the input string does not have the timezone offset included (for example, 03/01/2009 05:42:00 -5:00, Sat, 01 Nov 2008 19:35:00 GMT or 2008-11-01T19:35:00.0000000-07:00), then ensure that the DateTme.Kind is "Utc", then call DateTime.ToLocal() to convert it to the local time zone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With