?
Solved

Converting text to date

Posted on 2010-01-12
5
Medium Priority
?
322 Views
Last Modified: 2012-05-08
I have a table with dates that are stored as text:

021204
981112
000317

I want to convert the text to dates like this:

12/04/2002
11/12/1998
03/17/2000

I'm sure this should be quick and easy...I just can't seem to do it. Thanks!
0
Comment
Question by:BI_Dunce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26298900
example : SELECT CONVERT(DATETIME, CONVERT(CHAR(8), 20070824))
0
 
LVL 41

Accepted Solution

by:
ralmada earned 100 total points
ID: 26298931
In MS-Access try this:
select format(dateserial( left(yourcolumn, 2), mid(yourcolumn, 3, 2), right(yourcolumn, 2)), "MM/DD/YYYY")

Open in new window

0
 
LVL 14

Assisted Solution

by:pteranodon72
pteranodon72 earned 100 total points
ID: 26298971
In a query, create a field, strYYMMDD,

DateField: DateSerial(left(strYYMMDD,2), Mid(strYYMMDD,3,2),Right(strYYMMDD,2))


HTH,
pT72

0
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26299106
one question, do you want to convert them on the runtime or do you want to convert a column in your table?

0
 

Author Closing Comment

by:BI_Dunce
ID: 31676417
Both solutions worked, but pteranodon72's code was shorter and simpler. Thanks guys!! Much appreciated
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question