Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2008
    Posts
    4

    Convert string to date


    Hi everyone,

    I am in need of help converting a string yymmdd (ex: 080907 = Sept 7, 2008) to a date format as dd/mm/yyyy. I need to do this in a query or visual basic code?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried using the Mid() function?

  3. #3
    Join Date
    Jul 2008
    Posts
    4
    Yes, I ended up using
    CDate(mid([date],24),left([date],2),right([date],2)) to format it to mm/dd/yy
    then short date format on filed property to make it mm/dd/yyyy

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad you got it sorted. BTW, using date as a field name can be problematic since it is a reserved word. http://www.allenbrowne.com/AppIssueBadWord.html

  5. #5
    Join Date
    Jul 2008
    Posts
    4
    Lol, I have learned that the hard way. It is actually named nDate.

    Thanks!

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

Similar Threads

  1. Extract numbers from text string strored in a field.
    By khabdullah in forum Programming
    Replies: 2
    Last Post: 12-23-2007, 06:55 PM
  2. Creating a string from all records in a table
    By ocordero in forum Programming
    Replies: 2
    Last Post: 08-07-2006, 09:21 AM
  3. Replies: 1
    Last Post: 12-09-2005, 10:29 PM
  4. Replies: 0
    Last Post: 12-05-2005, 04:09 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