views:

359

answers:

1

I am trying to convert the pubDate in the Rss to EST. If you look at the links posted below, they have different timezones. Is there a function which takes any type of dateformat and convert to EST ?

http://rss.cnn.com/rss/cnn_topstories.rss

http://www.cricinfo.com/rss/content/story/feeds/0.rss

http://feeds.latimes.com/latimes/entertainment?format=xml

http://newsrss.bbc.co.uk/rss/newsonline_world_edition/business/rss.xml

A: 

Take a look at the ConvertTime method. For example:

var s = "Mon, 21 Dec 2009 14:09:45 GMT";
var date = DateTime.Parse(s, CultureInfo.InvariantCulture);
var est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var estDate = TimeZoneInfo.ConvertTime(date, est);
Darin Dimitrov
He'll still need to parse the strings.
SLaks
`DateTime.Parse("Mon, 21 Dec 2009 09:52:27 EST")` fails.
SLaks
Yes, an RFC 822 formatted datetime parser will be needed (http://stackoverflow.com/questions/284775/how-do-i-parse-and-convert-datetimes-to-the-rfc-822-date-time-format)
Darin Dimitrov
Darin, It works Like Magic. Thank you Very much for all of your efforts.
vamsivanka