I can’t seem to find anything on the nets on how to do this, but does anyone know how to format a C# DateTime in the W3CDTF format?
specifically, something like this: 1994-11-05T08:15:30-05:00 with the timezone offset
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately, .NET does not contain a standard format for the W3C-compliant DateTime (see the specification on http://www.w3.org/TR/NOTE-datetime).
W3C-compliant string containing date and time are very useful since this is the standard format for many technologies such as Sitemaps, PingBack, RSS and so on.
From Here
What they recommend is
AnyValidDateTime.ToUniversalTime().ToString("u").Replace(" ", "T");