Datetime.Today in GMT in c#
C#DatetimeTimezoneC# Problem Overview
I want to convert DateTime.Today
to GMT time.
i.e. If I am in L.A. and it is 11pm of 22/02/2012 I want DateTime.Today to be 23/02/2012 because it will be that day in GMT time.
C# Solutions
Solution 1 - C#
There is no DateTime.UtcToday
, but you can try DateTime.UtcNow.Date
Solution 2 - C#
DateTime.UtcNow
will give you the current universal time.
Solution 3 - C#
DateTime LocalToGMT = DateTime.Now.ToUniversalTime().AddHours(TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time").BaseUtcOffset.Hours);