DateTime Formating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I hav a log.txt file which contains following DateTime format > Fri May 06
18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
in my DataBase, so that my webapplication DataGrid can display above DateTime
format.
 
I hav a log.txt file which contains following DateTime format > Fri May 06
18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
in my DataBase, so that my webapplication DataGrid can display above DateTime
format.

string str = "Fri May 06 18:05:54 GMT+05:30 2005";
DateTime dt = DateTime.ParseExact(str, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy",
DateTimeFormatInfo.CurrentInfo);

Should do it.
 
Hi Tom
Thanks a ton for the mail, it has really helped me to read the DateTime from
the log.text file , but how do update this format into my SQL database coz in
my database table there is a Column named "DateTimeIn" which is unable accept
this
format > Fri May 06 18:05:54 GMT+05:30 2005.

Thanx !!
 
Back
Top