I am working on a project in which i am getting UTC DateTime in service response. I am trying to convert UTC DateTime to Datetime in specific time zone. i have tried System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId but it is unavailable in xamarin forms pcl.
Is there any solution or workaround to handle this scenario?
Thanks
(GMT-5:00) Eastern Time (US & Canada)Add the local time offset to the UTC time. For example, if your local time offset is -5:00, and if the UTC time is shown as 11:00, add -5 to 11. The time setting when adjusted for offset is 06:00 (6:00 A.M.).
Try to use ToLocalDateTime()
this way:
DateTime date = DateTime.Now;
var test = date.ToLocalDateTime();
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