Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Converting a string into a date

Posted on 1999-07-26
Medium Priority
Last Modified: 2010-04-30
I connect to an external database that supplies me with a date, but in a string format, like the individual records listed bellow:

I have to take these values and convert them into date variables, so that I can check if the date is earlier than today's date.

Question by:Stoke
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

EDDYK earned 200 total points
ID: 1527562

Author Comment

ID: 1527563
That's what I needed.
Thank you

Expert Comment

ID: 1527564
Here's another option

Option Explicit

Sub CheckForValidDates()

    Dim strDates() As String, strMsg As String
    Dim i As Integer, intCtr As Integer
    Dim blnValid As Boolean
    intCtr = 5
    ReDim strDates(1 To intCtr)
    strDates(1) = "15-Jul-99"
    strDates(2) = "29-Jul-99"
    strDates(3) = "05-Aug-1999"
    strDates(4) = "30-Sep-99"
    strDates(5) = "22-Oct-99"
    strMsg = "Valid Dates:"
    blnValid = False
    For i = 1 To intCtr
        If IsDate(strDates(i)) Then
            strMsg = strMsg & vbCrLf & strDates(i)
            blnValid = True
        End If
    Next i
    If blnValid Then
        MsgBox strMsg, vbInformation, "Good Dates"
    End If
End Sub

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question