tags:

views:

24

answers:

1

How can I get this datetime format for an RSS feed?

Mon, 06 Sep 2009 16:45:00 +0000
+1  A: 

I think you want DateTime.Now.ToString("r"),
where the 'r' indicates formatting following the RFC1123 pattern.

It will not (always) display an offset as +000, it will use 'GMT' and other standardized tz names.

As far as I can tell this one of the rare case where you don't have to specify an IFromatProvider.

Henk Holterman