Results 1 to 5 of 5

Thread: Date conversion

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    10
    Hi,
    I need to convert a date from mmddyy to yyyymmdd
    I am converting a text file where the date is in mmddyy format I have to convert it to a yyyymmdd.
    Please somebody help
    I tried the format functon but it doesn't seem to work
    Thanx

  2. #2
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96
    format should work

    Code:
    newdate = format(olddate, yyyymmdd)
    this should work even if your variables are of string or date value.

    H.
    Just trying to muddle through...

  3. #3
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96
    I also have a small piece of code that will validate and convert a string to the format you are looking for.

    I'll look it out for you.

    H.
    Just trying to muddle through...

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command1_Click()
        Dim olddate As String
        olddate = "11/20/00"
        MsgBox Format(olddate, " yyyy/mm/dd")
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96

    Cool

    Code:
    public function formatDate(dateInput as variant) as string
    If IsDate(dateInput) Then
                formatDate = Format(dateInput, "yyyymmdd")
            Else
                formatDate = vbNullString
            End If
    end sub
    validates and changes the format.

    H.
    Just trying to muddle through...

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