How to convert a date string to datetime value with custom date format?

  • Thread starter Thread starter ABC
  • Start date Start date
A

ABC

How to convert a date string to datetime value with custom date format?

e.g.
Date String Date Format Result (DateTime value)
"05/07/2004" "MM/dd/yyyy" May 7, 2004
"01062005" "ddMMyyyy" June 1, 2005
"09-07-05" "MM-dd-yy" Sept 7, 2005

Is there any functions to convert?
 
Hello,
You can use DateTime.Prase static method. You will have to provide the
format (IFormatProvider) using the
System.Globalization.DateTimeFormatInfo class. Please see MSDN for the
1. DateTime.Prase method
2. DateTimeFormatInfo class

HTH. Cheers.

Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
 
Back
Top