Problem Formatting Date

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am using VB.NET - VSNET 2003 and accessing data from an SQL Server. I am
trying to convert a datetime field retrieved from the DB to a format like
"MM/DD/YYYY" - I want results like "10/28/2004". I am trying the code:

CDate((rdr1.Item("Date"))).ToString("MM/DD/YYYY")

but when I look at the output it looks like this:

02/DD/YYYY

Here is a copy of the test I did while stepping through the code:

?CDate(rdr1.Item("Date")).ToString("MM/DD/YYYY")

"02/DD/YYYY"



What am I doing wrong?



Wayne
 
Wayne Wengert said:
CDate((rdr1.Item("Date"))).ToString("MM/DD/YYYY")

but when I look at the output it looks like this:

02/DD/YYYY

\\\
.... = foo.ToString("MM/dd/yyyy")
///
 
Herfried & Jay;

Boy, am I feeling stupid. I overlooked the case sensitivity. Thanks for the
help.

Wayne
 
Back
Top