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

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?
 
M

Maqsood Ahmed

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top