Suppose, we have a date field (Let say "Joining Date") in dd/MM/yyyy and you want to convert it into DateTime variable, then the following lines will help you to do so.
string DateofJoining = "25/08/2010";
System.Globalization.DateTimeFormatInfo
dtformat
= new
System.Globalization.DateTimeFormatInfo();
dtformat.ShortDatePattern = "dd/MM/yyyy";
DateTime dtJoiningDate = DateTime.Parse(FromDate, dtformat);
This will convert the string value into datetime("08/25/2012 12:00:00 AM").
Regards,
Prajanuranjan....
No comments:
Post a Comment