strate Posted June 29, 2005 Share Posted June 29, 2005 I want a program to verify the date that the user entered into the program to be valid (to a degree). The format for the user is "062905". If StringMid($Date,3,2) <> 01 To 31 Then MsgBox(0,"Notice 23","Bad") Exit EndIfI want something like that (above) to check the day, but that clearly will not work. Is there another method to go about this? Another issue is If StringTrimLeft($Date,4) <> StringTrimLeft(@year,2) Or StringTrimLeft($Date,4) <> StringTrimLeft(@year,2)+1 Then MsgBox(0,"Notice 19","Bad") Exit EndIf This doesn't work also. At the end of the year we will start packing stuff for the next year so it needs to allow the next year to be accepted (this is the same for the month). Here is what I have so far all together:$Date = InputBox("Trial","Date:","040506") If StringLen($Date) <> 6 Then MsgBox(0,"Notice 3","Bad") Exit EndIf If StringIsDigit($Date) = 0 Then MsgBox(0,"Notice 7","Bad") Exit EndIf If $Date = "" Then MsgBox(0,"Notice 11","Bad") Exit EndIf If StringTrimRight($Date,4) <> @MON Then ;~ Or StringTrimRight($Date,4) <> @MON +1 Then MsgBox(0,"Notice 15","Bad") Exit EndIf If StringTrimLeft($Date,4) <> StringTrimLeft(@year,2) Then ;~ Or StringTrimLeft($Date,4) <> StringTrimLeft(@year,2)+1 MsgBox(0,"Notice 19","Bad") Exit EndIf If StringMid($Date,3,2) <> 01 To 31 Then MsgBox(0,"Notice 23","Bad") Exit EndIf Any ideas would be great I'm sure I'm just missing something. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
Valuater Posted June 29, 2005 Share Posted June 29, 2005 I might have something... but what is the purpose ... do you expect thge user to put in a date? and for what reason? 8) Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted June 30, 2005 Share Posted June 30, 2005 Format the string as you want, and then I believe that _DateIsValid() is the correct function Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now