I would like to convert my date to a format of yymmdd without separators in order to use as a string in a file name. How do I convert the system date to this format?
I'm new to VBScript (but familiar with VB). From what I have gathered, VBScript doesn't supply a built-in Format() function like VB, otherwise this would only take one line.
Dim dt
Dim sp
Dim res
dt=Now()
sp=Instr(1,dt," "
yr=Mid(dt,sp-2,2)
dy=Mid(dt,sp-5,2)
mo=Mid(dt,1,Instr(1,dt,"/"-1)
If (Len(dy)=1) Then dy="0" & dy
If (Len(mo)=1) Then mo="0" & mo
res=yr & mo & dy
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.