Skip to content

Instantly share code, notes, and snippets.

@kunst1080
Created February 22, 2014 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunst1080/9149971 to your computer and use it in GitHub Desktop.
Save kunst1080/9149971 to your computer and use it in GitHub Desktop.
check real date
@if (1==1) /*
@CScript //nologo //E:JScript "%~f0" "%~1" "%~2"
@exit /b
@rem */
@end
function isDate(str){
y = str.substring(0, 4);
m = str.substring(4, 6) - 1;
d = str.substring(6, 8);
ymd = new Date(y, m, d);
return y == ymd.getFullYear() && m == ymd.getMonth() && d == ymd.getDate();
}
if (isDate(WScript.Arguments(0))) {
WScript.Quit(0);
} else {
WScript.Quit(9);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment