Convert UTC (Greenwich Mean Time) from a string to DateTime type in C#

esak2000
esak2000 used Ask the Experts™
on
I download XML UTC string values in UTC format, like  '2011-02-28T19:43:53+00:00'
How can I convert this value to a DateTime format in C#?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Are you after something like this?

var date = DateTime.Parse("2011-02-28T19:43:53+00:00", null, DateTimeStyles.AdjustToUniversal);

//do something with date
Console.WriteLine(date.Hours);

Open in new window

Author

Commented:
Just what I wanted, thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial