Here you go..
option explicit
dim dateMod
If WScript.Arguments.Count <> 1 Then
dateMod = -1
Else
dateMod = WScript.Arguments(0)
End If
dim y
y = DateAdd("d", dateMod, Date)
dim yS(2)
yS(0) = Year(y)
yS(1) = Month(y)
yS(2) = Day(y)
dim i
for i = 1 to 2
if 1 = Len(yS(i)) then yS(i) = "0" & yS(i)
next
WScript.Echo Join(yS, "")
This can be invoked from the command line with the following in a batch script:
@ECHO OFF
FOR /F %%s in ('cscript //NoLogo GetRelativeDate.vbs') DO (
SET LOG_DATE=%%s
)
ECHO %LOG_DATE%