I want to initialize DateTime to Eastern Standard Time and then convert to universal time.
I have One DateTime (CurrentDT) whose TimeZone is not set, but it is in EST. he parsedExact from next sting
"ddd, d MMM yyyy H: mm: ss"
I wrote the following code to solve the problem.
TimeZoneInfo currentTimeZone=null;
currentTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
CurrentDT=TimeZoneInfo.ConvertTime(CurrentDT, currentTimeZone);
CurrentDT = CurrentDT.ToUniversalTime();
The problem is that it looks like I'm doing wrong. I am converting a DateTime that is in the local time zone to Eastern Standerd Time, and then to universal standard time. I do not know how I can initialize TimeZone from CurrentDt first. Please help me understand, thanks.