I'm trying to parse a date to the format 'yyyymmdd'. The date comes from an excel cell that is formated for dates like mm/dd/yyyy.
I read the cell into an arraylist and try to format it something like this
Dim a as new arraylist
Dim xl as excel.application
xl.workbooks.open ...
Dim s as string
Dim i as integer = 0
s = Ctype(xl.cells(r,c).value,string)
a.add(s)
Dim d as new datetime
d = a(i)
Dim ds as string
ds = d.tostring("yyyymmdd")
if I read 10/22/2006 from the spreadsheet, the value d will contain the value #10/22/2006#, but ds will contain 20060022
if I replace d=a(i) with d=ctype(s,datetime), I get the same result. VB's format function does the same thing.
Any suggestions

Formatting date in vb.net when the date comes from Excel 2003
Bodylojohn
Include the date seperators in the format string...
ds = d.tostring("yyyymmdd") -----> ds = d.tostring("yyyy/mm/dd")