If I get the RFC-1123 formatting date of a DateTime object, it gives the current local time, but gives the time zone as GMT (which is inaccurate).
DateTime.Now.ToString("r");
is returning
Fri, 12 Feb 2010 16:23:03 GMT
At 4:23 in the afternoon, but my time zone is UTC + 10 (plus, we are currently observing daylight saving time).
Now I can get the return value that is “correct” by first converting to UTC:
DateTime.UtcNow.ToString("r");
returns
Fri, 12 Feb 2010 05:23:03 GMT
However, ideally, I would like to get the correct time zone, which, I think, will be
Fri, 12 Feb 2010 16:23:03 +1100
Passing to the current CultureInfo does not change anything. I could get the UTC offset from TimeZoneInfo.Local.GetUtcOffset (...) and format the timezone line, but removing the GMT bit and replacing it seems futile.
Is there a way to get it to enable the correct time zone?
source
share