how to convert datetime format?  
Author Message
tongkusat





PostPosted: Visual C# Language, how to convert datetime format? Top

if I want to convert datetime format 1 into format 2, how can i do see the 2 formats.

1----NOVEMBER 08, 2006 @ 06:36 PM

2----Wed, 08 Nov 2006 18:36:07 GMT

format 1 is from webpage, format 2 is from xml file....

i want to compare them...

thanks.



Visual C#9  
 
 
Lepaca





PostPosted: Visual C# Language, how to convert datetime format? Top

you can convert strings in a datetime variable, then compare these...

DateTime d1 = DateTime.ParseExact("NOVEMBER 08, 2006 @ 06:36 PM", "MMMM dd, yyyy @ hh:mm tt", Globalization.CultureInfo.GetCultureInfo("en-us"))

DateTime d2 = DateTime.ParseExact("Wed, 08 Nov 2006 18:36:07 GMT", "ddd, dd MMM yyyy HH:mm:ss G\MT", Globalization.CultureInfo.GetCultureInfo("en-us"))