better way to format dates -
02-10-2004
, 06:13 PM
I need to create a folder with the date on it using VBS in
DTS. If I created one today, it would be named "2102004".
I need it to be "02102004". I can acheive this using my
example, but it seems as though there would be a better
way. Plus searches would be really tough.
Function Main()
dim month, day
if datepart("m",date) <= (9) then month = "0" &
datepart("m",date) _
else month = datepart("m",date) _
end if
if datepart("d",date) <= (9) then day = "0" &
datepart("d",date) _
else day = datepart("d",date) _
end if
msgbox month & day & datepart("yyyy",date)
Main = DTSTaskExecResult_Success
End Function
Any ideas?
TIA, Chris |