Results 1 to 4 of 4
  1. #1
    di.miller is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3

    Question Date format issue

    Hi All,

    I have an Access database with a field called COMPLETEDATE that is of the value string that has the format of "1110315". Here is where it gets weird. I need to drop off the leading 1 to make the data look like "110315" and convert this to the type Date. I have figured out that I can drop the leading 1 in Access by using the code:


    Code:
    SELECT Right([HBELP_FINAL_Q.COMPLETEDATE],6) AS RealCompleteDate
    This returns values like "110315" which I like but, I still have an issue to deal with. How do I modify this code to convert it to a Date type?

    I tried using:
    Code:
    SELECT CDate(Right([HBELP_FINAL_Q.COMPLETEDATE],6)) AS RealCompleteDate
    but the results became like 1/11/2022 and strange numbers like the year 2176!

    Can someone please help me figure out how to modify my code to convert this to a date type with a format of yymmdd?

    Any help is greatly appreciated, this is driving me crazy!
    -Diana

  2. #2
    William McKinley is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    59
    I import the exact same date format into my database. I used this function, might not be the best way but it works:

    Code:
    Transaction Date: DateValue(Format(([YourField]+19000000),"@@@@\/@@\/@@"))

  3. #3
    di.miller is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3

    I don't understand

    Hi William,

    I don't really understand your code. Do I place this code in my Select statement? What will the final output look like?

    Thanks so much for your help,
    Diana

  4. #4
    di.miller is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3
    I found an answer on another forum and here is what worked for me:

    CDate("20" & Format(Mid([HBELP_FINAL_Q.COMPLETEDATE],2),"00-00-00"))

    Hope this can help others with similar problems.
    -Diana

Please reply to this thread with any new information or opinions.

Similar Threads

  1. American/European date format issue
    By dantnz in forum Programming
    Replies: 2
    Last Post: 12-09-2010, 03:17 PM
  2. Format Issue
    By trueblue7 in forum Reports
    Replies: 4
    Last Post: 12-04-2010, 10:50 PM
  3. Date Format
    By lonewolfwfk in forum Programming
    Replies: 4
    Last Post: 11-25-2010, 09:00 PM
  4. date format
    By dollygg in forum Access
    Replies: 2
    Last Post: 01-19-2010, 10:14 AM
  5. Access 2007: Percent Format Issue
    By diane802 in forum Access
    Replies: 6
    Last Post: 12-30-2009, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums