Domanda

Sto cercando di convertire il pubDate nella Rss a EST. Se guardate i link postato qui sotto, hanno fusi orari diversi. C'è una funzione che prende qualsiasi tipo di dateformat e convertire in 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

È stato utile?

Soluzione

Date un'occhiata al metodo ConvertTime . Ad esempio:

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top