Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Philadelphia, Pennsylvania
    Posts
    676
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date conversion (Access 2003)

    I get a file from Oracle where the date is shown as text OCT-06 for instance. I was shown in the Excel forum how to convert that to a logical date via EOMONTH(Datevalue("1-"&a1),0) to get a usable end of month value for pivot tables and other uses. My question: the report we have to work with now must be handled in Access. Is there a corresponding function I could use. I could not immediately locate it in the Help file. Or is there some other expression that can get the job done? Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date conversion (Access 2003)

    Say that your field is named DateField. The following expression returns the last day of the month:

    DateSerial(Year(DateValue("1-" & [DateField])), Month(DateValue("1-" & [DateField))+1, 0)

    "1-" & [DateField] results in a text string such as "1-OCT-06". The DateValue function converts this to a date. We compute the year of this date, compute the month and add 1 (i.e. next month) and use 0 as the day. The DateSerial function interprets the 0th day of the next month as the last day of the current month.

Posting Permissions

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