Saturday, March 31, 2012

string to formated datetime

how can I convert a string like this "10/04" meaning octuber/2004 to a valid
DateTime?
"Alejandro Penate-Diaz" wrote:

> how can I convert a string like this "10/04" meaning octuber/2004 to a valid
> DateTime?
>
CDate function:

http://msdn.microsoft.com/library/d.../vsfctcdate.asp

Check the parameters that CDate is expecting. You may need to do some text
parsing and string manipulation before calling CDate.
You will use the .ParseExact method of DateTime.

Dim dt as DateTime
dt = DateTime.Parse( "10/04", "MM/yy" )

DateTime dtC = DateTime.Parse( "10/04", "MM/yy" );

HTH,

bill

"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:%23dwiz$jJFHA.2136@.TK2MSFTNGP14.phx.gbl...
> how can I convert a string like this "10/04" meaning octuber/2004 to a
valid
> DateTime?

0 comments:

Post a Comment