Solved

Date Format : yyyymmdd to mm/dd/yyyy  MS Access 2010

Posted on 2013-06-17
4
7,016 Views
Last Modified: 2013-06-17
I have a filed in my access table in yyyymmdd (20130616) format and  I have to change that to mm/dd/yyyy (06/16/2013). Please Help.There is many number of records there in the table.
0
Comment
Question by:gtmathewDallas
[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
  • 2
4 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 39254132
What is the data type?

If you are already using the Date data type (best practice), simply go into the table design and change the number format in the column properties.

If it is text, then you could use a query like this:

UPDATE [tablename]
SET [columnname] = Mid([columnname], 5, 2) & "/" & Right([columnname], 2) & "/" & Left([columnname], 4)
WHERE [columnname] Like "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"

Open in new window


Note that you would also want to find any rows that did not have an entry matching the old format:

SELECT *
FROM [tablename]
WHERE Not [columnname] Like "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"

Open in new window


However, I think your current format is much better than mm/dd/yyyy, as there would be no ambiguity over the order of the date parts.

If you are using a numeric data type (Long, Single, or Double), you will not be able to store the /s.
0
 

Author Comment

by:gtmathewDallas
ID: 39254212
The data type is in number, the reason to converting  yyyymmdd to this mm/dd/yyyy format is  there is another date field in the table with mm/dd/yyyy format.
After making both date fields in to same format- I need to compare those two date fields and find out the record which are not same.
0
 
LVL 40

Accepted Solution

by:
als315 earned 500 total points
ID: 39254236
You can convert number to date format with Dateserial function:
DateSerial(Left([YourField],4),Mid([YourField],5,2),Right([YourField],2))
0
 

Author Closing Comment

by:gtmathewDallas
ID: 39254410
Thank You So Much... It Is Working Good
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

734 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