Results 1 to 4 of 4

Thread: Using period (".") as decimal separator

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    21

    Post

    I have a VB6 application that manages dates in many ways and one of my customers likes to use a period (".") as date separator in its regional settings. The glitch is that it does not seem to be supported by VB since when I use a period as date separator and I call...

    IsDate(Format(Now))
    - or -
    IsDate("01.01.2000")

    ...it always return False. And when I call...

    CDate(Format(Now))
    - or -
    CDate("01.01.2000")

    ...it gives me a run-time 13 (Type Mismatch).

    Even if I use other separators for decimal and thousand, it keeps failing.

    Anybody has ever heard of this? If so, does somebody have a solution?

    My application is quite big and I am affraid workarounds would not solve my problem.

    Thanks in advance,
    Tipi


  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    Change the date/time separator in Control Panel / Regional Settings - not only will this display all dates with . between the numbers but the IsDate function (which uses the control panel settings) will return True.

    I think.. !!



    ------------------
    Mark "Buzby" Beeton
    VB Developer
    [email protected]



  3. #3
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    One thing you can do is use the VB6 Replace function to replace the . with - ....
    eg.
    Dim sTemp As String
    sTemp = Replace(txtDate.Text, ".", "-")
    And then use sTemp to check if entered date is valid.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    21

    Post

    I guess I was not clear enough. I already use a period in my regional settings. The problem is that:

    IsDate("01.JAN.2000")
    - and -
    IsDate(Format(Now))

    return False. The second example will work if you use a MM month format. It will fail with a MMM month format. I have made a mistake in my first message when I mentionned that "01.01.2000" would return False.

    Thanks,
    Tipi


    [This message has been edited by Tipi (edited 02-15-2000).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width