kojoma
kojoma

Reputation: 313

Format 2 strings to RSS PubDate

ive got 2 strings, date:"27.03.11 " and time:"15:04", which id like to format as a PubDate elemnt for a rss file like Fri, 18 Nov 2005 19:12:30 GMT. How can i do this in c sharp?

Upvotes: 1

Views: 1844

Answers (1)

Heinzi
Heinzi

Reputation: 172220

Use the following steps:

Since RSS requires dates to be in the RFC 822 format, the following related SO question might help you with the last step:

EDIT: For the first step, have a look at this example:

var s = "27.03.11 15:04"; 
var dtm = DateTime.ParseExact(s, @"dd.MM.yy HH\:mm", null);

(The \: ensures that : is seen as a literal : rather than a culture-specific time separator.)

Upvotes: 2

Related Questions