#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Sydney
    Posts
    33
    Rep Power
    12

    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
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Well, first I would say try it and see.
    Here is more info on the function:
    http://msdn.microsoft.com/library/de...sfctisdate.asp
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    138
    Rep Power
    12
    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.
    --

    ngibsonau
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    St. Louis, MO USA
    Posts
    43
    Rep Power
    12
    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
    http://www.customfittech.com

    Access to MySQL Conversion Tool,
    Visual XSLT Conversion Tool

IMN logo majestic logo threadwatch logo seochat tools logo