Link to home
Start Free TrialLog in
Avatar of gtmathewDallas
gtmathewDallas

asked on

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

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.
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

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.
Avatar of gtmathewDallas
gtmathewDallas

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You So Much... It Is Working Good