Results 1 to 3 of 3

Thread: [RESOLVED] IsDate question

  1. #1

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Resolved [RESOLVED] IsDate question

    I'm working on a existing project where displays in a ListView are getting corrupted from a sort routine. This issue is the logic is treating a dollar amount as a date. It basically comes from a check similar to this:

    Code:
    Dim strTestIt As String
    strTestIt = "200.00"
    If IsDate(strTestIt) = True Then
        MsgBox "Date"
    Else
        MsgBox "Not date"  '<== Tests not a date
    End If
        
    strTestIt = "10.00"
    If IsDate(dTestIt) = True Then
        MsgBox "Date"       <== Tests as a date
    Else
        MsgBox "No date"
    End If
    It is after "23.00" that VB longer considers it a date. What's going wrong?

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: IsDate question

    Actually TIME is also a date. So any TIME value will evaluate to a valid date with the IsDate function.
    I assume it is considering it as a time and hence a valid date.

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: IsDate question

    Quote Originally Posted by Pradeep1210
    Actually TIME is also a date. So any TIME value will evaluate to a valid date with the IsDate function.
    I assume it is considering it as a time and hence a valid date.

    Pradeep
    That seems to test out as true right up to "23.59". Thanks!

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