jmangrum Posted July 13, 2005 Share Posted July 13, 2005 I have tried using the date validation and always comes back invalid. This is the code I am using.. Is there something simple that I am missing? Thanks $validtest = "Failed" $sDate = @MON & "/" & @MDAY & "/" & @YEAR Do $maindate = InputBox ( $company, "Please Enter A Date That You Want To See The Reports From -- In the format dd/mm/yyyy" , $sDate ) If _DateIsValid( $maindate ) Then MsgBox( 0, "Valid Date", $maindate & @error ) $validtest = "Passed" Else MsgBox (0, $company, "Invalid Date "& $maindate & " Please Try Again " & @error, 10 ) EndIf Until $validtest = "Passed" Joseph MangrumCCNA, CNA, MCP, Network+ Link to comment Share on other sites More sharing options...
seandisanti Posted July 13, 2005 Share Posted July 13, 2005 If _DateIsValid( $maindate ) Then MsgBox( 0, "Valid Date", $maindate & @error ) $validtest = "Passed" Else MsgBox (0, $company, "Invalid Date "& $maindate & " Please Try Again " & @error, 10 ) EndIf<{POST_SNAPBACK}>this may be nothing, but why have @error output on success? Link to comment Share on other sites More sharing options...
jmangrum Posted July 13, 2005 Author Share Posted July 13, 2005 this may be nothing, but why have @error output on success?<{POST_SNAPBACK}>Sorry, that was left accidentally to see if there was an error return code associated with it, and there is but if that is the case, then why run it as an IF statement. Even if it is out, still get all dates invalid since all I am doing is displaying it to see what it returns Joseph MangrumCCNA, CNA, MCP, Network+ Link to comment Share on other sites More sharing options...
Developers Jos Posted July 13, 2005 Developers Share Posted July 13, 2005 I have tried using the date validation and always comes back invalid. This is the code I am using.. Is there something simple that I am missing?Thanks<{POST_SNAPBACK}>I was sure i fixed this back in April but seems it slipped through the cracks...The Helpfile is wrong and should say:This function takes a date input in one of the following formats: "yyyy/mm/dd[ hh:mm[:ss]]" or "yyyy/mm/dd[Thh:mm[:ss]]" "yyyy-mm-dd[ hh:mm[:ss]]" or "yyyy-mm-dd[Thh:mm[:ss]]" "yyyy.mm.dd[ hh:mm[:ss]]" or "yyyy.mm.dd[Thh:mm[:ss]]"Example should say:#include <Date.au3> $sDate = @YEAR & "/" & @MON & "/" & @MDAY If _DateIsValid( $sDate ) Then MsgBox( 4096, "Valid Date", "The specified date is valid." ) Else MsgBox( 4096, "Valid Date", "The specified date is invalid." ) EndIfWill submit the Doc correction to JP... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
seandisanti Posted July 13, 2005 Share Posted July 13, 2005 Sorry, that was left accidentally to see if there was an error return code associated with it, and there is but if that is the case, then why run it as an IF statement. Even if it is out, still get all dates invalid since all I am doing is displaying it to see what it returns<{POST_SNAPBACK}>right, sorry i figured it out as soon as i started playing with it... one thing that i think is kind of interesting is that on the fail that @error is 0, which the help file says means no error... that made me think it may be an issue with your condition statement. i ran into something like this the other day where i was doing a stringinstr() with numbers, and even though i could plainly see that the sub string i was looking for was in the string being evaluated, it kept saying false... i'm going to look back at that and see if it's not a similar type of issue... Link to comment Share on other sites More sharing options...
blindwig Posted July 13, 2005 Share Posted July 13, 2005 The Helpfile is wrong and should say:[...]Will submit the Doc correction to JP...<{POST_SNAPBACK}>Also, the help file says that the routine should set error codes to indicate the problem in processing the date, but there are not errors set in the source. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Developers Jos Posted July 13, 2005 Developers Share Posted July 13, 2005 (edited) Also, the help file says that the routine should set error codes to indicate the problem in processing the date, but there are not errors set in the source.<{POST_SNAPBACK}>correct.... have changed that too....here's the new helpfile page: Edited July 13, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jmangrum Posted July 13, 2005 Author Share Posted July 13, 2005 correct.... have changed that too....here's the new helpfile page: <{POST_SNAPBACK}>Excellent, I see why that may have gone bad then. Thanks, that will help out alot. I will give it a run and if anything else comes up I will let you know.Thanks for all the replies.. Joseph MangrumCCNA, CNA, MCP, Network+ 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