Quantcast
Channel: Take Command / TCC
Viewing all articles
Browse latest Browse all 1732

Date Difference, passing dates in several formats

$
0
0
Here's a library function that uses the script command, the tcommand() interface, and VBScript, to determine the number of years (full and part) given a date by the user;
Code:
DateDiff {
@setlocal
@echo off
set dest=%temp\vb.vbs

set theDate=%1

if defined theDate (
::NEXT SENTENCE
) else (
set theDate=%_isodate
)

>%dest echo TakeCommand.tcommand("echo " + CStr(DateDiff("d", "%theDate", Now) / 365.25))

set _DateDiff=%@execstr[script %dest]

echo %_DateDiff

endlocal _DateDiff...

Read more

Viewing all articles
Browse latest Browse all 1732

Trending Articles