Check for valid time input from user
Posted: 06/25/98Note: Use this script at your own risk....
This is un-tested code written by one of our users and
posted to the WebBoard "WinBatch script exchange" conference.; CHKDATE.WBT ; =========== ; Check date demo. ; This code snippet verifies a given date by adding "nothing" (0 seconds) ; to it. If (and only if) an error occurs, the date is invalid. sTitle="Check Date Demo" nPrevErrMode=ErrorMode(@OFF) dToday=TimeYmdHms() dDate=AskLine(sTitle, "Please enter a date (YY:MM:DD:hh:mm:ss)", dToday) dNothing="00:00:00:00:00:00" LastError() dDate2=TimeAdd(dDate, dNothing) ;<-- this line does all the work If LastError() Message(sTitle, "Sorry, the date you entered is invalid !") Else Message(sTitle, "Well that's my favorite date, too !") EndIf ErrorMode(nPrevErrMode) Exit
Article ID: W13861Filename: Check for valid time input from user.txt