How to convert DateTime in Specific timezone?
问题 I find it hard to understand how UTC works. I have to do the following but I'm still confused if I'd get the right result. Objectives: Ensure all saved dates in Database are in UTC format Update DefaultTimezone is in Manila time Ensure all returned dates are in Manila Time So the code is: public ConvertDate(DateTime? dateTime) { if (dateTime != null) { Value = (DateTime)dateTime; TimeZone = GetFromConfig.DefaultTimeZone(); } } public ConvertDate(DateTime? dateTime, int GMTTimeZone) { if