February 2nd, 2003, 05:10 PM
IsDate - not so obvious
I realise that the IsDate function returns true if the argument passed to it can be converted to a date....but i'm not exactly sure what formats VBScript will recognise as dates....
the examples i've seen don't cover the format i want to use, so can somebody just provide a quick answer of what IsDate will return if i pass it a date in the format: 24/Jan/1984, that is, dd/mmm/yyyy....hopefully it will return true
February 3rd, 2003, 11:15 AM
February 27th, 2003, 03:12 PM
Be aware that the windows locale will affect dates, currency etc.
In particular dates dd/mm/yyyy and mm/dd/yyyy are ambiguous for small values of dd and mm for a lot of windows date functions.
If you have a locale which takes dd/mm/yyyy but put an invalid month value in and have a day that will be a valid month, the values will be magically switched.
eg. 10/20/2003 will be converted into 20th October 2003 which under the dd/mm/yyyy will actually be 20/10/2003.
So the try it and see method may get a bit confusing.
March 1st, 2003, 09:39 PM
you could always detect your 80% locales and provide a parse function depending on the locale, assuring that the date is properly formatted before entering your code.
But from personal experience, I have found that usually problems like these are best kept out of back end code, and solved by very very rigid user input code and clear instructions. If this is NOT a user interface input method for your date value, then I would analyze your data and rule out certain "out there" circumstances, and only code for the crazy stuff when and if it occurs. This may sound lazy, but as I am paid hourly as a freelance consultant, I just inform the client of my decision and they are usually thankful to save the money up front.
- Chris of Custom Fit Technology
Access to MySQL Conversion Tool,
Visual XSLT Conversion Tool