Jump to content
Sign in to follow this  
mr_unreliable

a "Validate_DateTimeLocalFormat()" function

Recommended Posts

mr_unreliable

The "Validate_DateTimeLocalFormat()" function is intended to check whether a date+time string is valid IN THE CONTEXT OF THE "LOCALE" FORMAT, i.e., the format used in your country (or even some format peculiar to your own organization or application).

There is a "_DateIsValid" function in the "date.au3" include file, which checks a date+time string for conformance with an ISO standard.

If you are NOT conforming to that ISO standard, but rather are using some local standard like the one sometimes used in the U.S. (i.e., mm/dd/yy hh:mm:ss xM), then this function is for you.

Also note, this function is using the vbScript "RegExp" (regular expression) object, rather than a "brute force" approach (i.e., character-by-character testing), to validate the string.

Yes, yes, I do know that autoit has its own regexp function. I was just experimenting with the feasibility of using "external objects" in autoit code (in this case a vbs object). And it worked, sort of.

While this function may be expanded through the use of regexp pattern matching, as coded it will only test for one local variation, that is a proper U.S. datetime format...

cheers, jw

auiIsDateTimeValid_wRegExp.au3

mru.ico

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.