DateTime.ToString("R")

  • Thread starter Thread starter Marc Gravell
  • Start date Start date
M

Marc Gravell

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
 
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top