• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
The @DATE function returns the number of days since January 1, 1980. So, when I issue the command;
echo %@date[2015-03-10]
it returns 12852, which is the number of days since January 1, 1980 until March 10, 2015.

To convert that number back into a date, you would use the @MAKEDATE function.

As the @MAKEDATE function is not in TCC/LE, I have written a similar function using VBScript.

' MakeDate.vbs
' TCC/LE 13 does not include the @MAKEDATE function.
' This VBScript provides a similar function.
' NumberOfDays is interpreted as the number of days since 1980-01-01,
'  and must be in the range 0 to 43829 (corresponding to the date 2099-12-31).
' USAGE: echo %@execstr[cscript.exe //nologo MakeDate.vbs 12852]
StartDate = "1980-01-01"
NumberOfDays = WScript.Arguments.Item(0)

TheDate = DateAdd("d", NumberOfDays, StartDate)
TheDate = FormatDateTime(TheDate,2)

WScript.echo DatePart("yyyy",TheDate) & "-" & Right("0" & DatePart("m",TheDate), 2) & "-" & Right("0" & DatePart("d",TheDate), 2)
Now, when I issue the command;
echo %@execstr[cscript.exe //nologo MakeDate.vbs 12852]
it returns 2015-03-10.

Note also that the ISO8601 Plugin, written by Charles Dye, has a @MAKEDATE function, but has a date range from 1601-01-01 through to 9999-12-31. It is available from http://prospero.unm.edu/plugins/iso8601.html