470,586 Members | 1,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

DateTime.ToString("R")

Just been debugging a daylight savings glitch... something that
interested me:

(in a BST locale at 5:14 local time, 4:14 GMT)

DateTime.Now.ToString("R") >"Mon, 26 Mar 2007 05:14:34 GMT"

However...
DateTime.Now.IsDaylightSavingTime() >true

DateTime.UtcNow.ToString("R") >"Mon, 26 Mar 2007 04:17:04 GMT"

Doesn't that make the DateTime.Now.ToString("R") incorrect by RFC822?
Shouldn't it be using local offset?

Anyways... fixed using UTC formats ;-p

Marc

Mar 26 '07 #1
1 8425
RTFM to myself:

<q>Formatting does not modify the value of the DateTime object that is
being formatted. Therefore, the application must convert the value to
Coordinated Universal Time (UTC) before using this format specifier.</
q>

Mar 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Greg Collins [Microsoft MVP] | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.