c# - The string was not recognized as a valid DateTime, There is an unknown word starting at index 25 -


i grabbing pubdate node xml file, item.pubdate have date grabbed.

newsitem.date datetime column in database table column.

but cant seem parse datetime.

i "the string not recognized valid datetime, there unknown word starting @ index 25"

item.pubdate have value: "thu, 9 may 2013 05:04:18 pdt"

when try:

newsitem.date = datetime.parse(item.pubdate); 

i error.

how come other xml files pubdates works?

and have "thu, 09 may 2013 09:15:11 gmt"?

your string contains pdt (timezone info), can't parse in string replace empty string , parse.

newsitem.date = datetime.parse(item.pubdate.replace(" pdt","")); 

if string contains gmt

datetime.parse

s contains z or gmt time zone designator, , styles includes roundtripkind flag. date , time interpreted utc.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -