Is there anyway to change numbers to a date format?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haiiiii4
    New Member
    • Jul 2014
    • 1

    Is there anyway to change numbers to a date format?

    Im rebuilding a database and need to covert a field where the value is a date but its in as '20060603'

    I'd like to make a query to convert it to
    '03/06/2006'

    Is this possible, if so, how?

    Also, I have to do it for 14 fields so is there an easy way to do them all as one query?

    Thanks
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    If your "Date" field is always exactly as you display it, in text format, try this:

    Code:
    CDate(Left(DateField,4) & "-" & _
        Mid(DateField,5,2) & "-" & _
        Right(DateField,2))
    This should disambiguate the date field into text that "looks"" like a date to Access. It should put it in the right format, but it may also be affected by your regional settings on your system.

    You may have to trick the code more by converting the month number to a text number (i.e. "06" becomes "Jun"), but try this first.

    Comment

    Working...