Created
February 22, 2014 07:12
-
-
Save kunst1080/9149971 to your computer and use it in GitHub Desktop.
check real date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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