Results 1 to 4 of 4
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    field has date typed as text and i need to convert to date

    I have a field that the date is typed out as


    Saturday 16 February 2013 11:54:06 PM

    I need to be able to convert that to a real date. Is this something better done in excel or can this be done it access.

    The date is typed out, it is not formatted to look like a date field. The data came downloaded from an ecommerce site with the date actually typed out for some reason.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  3. #3
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    This query breaks the string into their time, date, and date/time components:
    Code:
    SELECT CDate(Mid([richtext],InStrRev([richtext]," ")+1)) AS Time1, CDate(Mid([richtext],InStr([richtext]," ")+1,InStrRev([richtext]," ")-InStr([richtext]," ")-1)) AS Date1, [Date1]+[Time1] AS MyDate
    FROM Table1;
    Or you can use an update query to update a Date data type field in your table:
    Code:
    UPDATE NameOfTable SET NameOfTable.NameOfDateField = CDate(Mid([DateString],InStr([DateString]," ")+1,InStrRev([DateString]," ")-InStr([DateString]," ")-1))+ CDate(Mid([DateString],InStrRev([DateString]," ")+1));
    Ron

  4. #4
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Is this in a form? Report?
    In the properties you can set the Data control source to =Date () and it will always automatically insert the current date. Or in Format properties set the format to whichever style of date you desire (general date, long date, short date, medium date) and click 'for dates' in the "show date picker" property and you can pick the date you want if you are entering data into a form.

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

Similar Threads

  1. Convert Text Column To Date
    By jo15765 in forum Queries
    Replies: 6
    Last Post: 01-16-2015, 03:41 PM
  2. Convert Text String to Date in SQL
    By kestefon in forum Access
    Replies: 2
    Last Post: 12-04-2013, 03:33 PM
  3. Replies: 3
    Last Post: 09-11-2013, 09:49 AM
  4. Convert text date to date value
    By unslog in forum Access
    Replies: 8
    Last Post: 02-01-2012, 12:22 PM
  5. Replies: 1
    Last Post: 08-07-2011, 07:58 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