Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    MN
    Posts
    10

    Unanswered: convert number to date data type

    easy question here.

    I have:
    0123
    0125
    0227
    0327
    04..
    05..
    06..
    07..
    08..
    09..
    ..
    1231

    The first two numbers is the month and the second two numbers is the day of the month.

    I need to display 01 as Jan, 02 as Feb and so on.

    left(field1, 2) --- I know this grabs the first two numbers, but how do I convert it to a date data type?

  2. #2
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: convert number to date data type

    Originally posted by ericksob
    easy question here.

    I have:
    0123
    0125
    0227
    0327
    04..
    05..
    06..
    07..
    08..
    09..
    ..
    1231

    The first two numbers is the month and the second two numbers is the day of the month.

    I need to display 01 as Jan, 02 as Feb and so on.

    left(field1, 2) --- I know this grabs the first two numbers, but how do I convert it to a date data type?
    You may use arrays:

    Dim Month(11) as string ' Don´t forget that the first position is month(0)

    Month(0) = "Jan"
    Month(1) = "Feb"
    .
    .
    .
    .
    .
    Month(11) = "Dec"


    Now, u may use like this:

    msgbox Month( val( left(field1,2)))
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

Posting Permissions

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