Solved

date format - MS Access 2010

Posted on 2013-06-17
7
709 Views
Last Modified: 2013-06-17
My date in access table is in ddmmyyyy (29052013) format, how can i convert that in to mm/dd/yyyy format? I have around 600 rows in the table, Please help
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
  • 4
  • 3
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 39253782
What is the datatype of your date field?
0
 

Author Comment

by:gtmathewDallas
ID: 39253789
Its in number
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 39253820
Then you need to create a new field in your table which is a datetime field.  You can set the format of that field to whatever you want to see displayed.

You then need to use an update query to convert the existing value to a date and place it in the new field.  That will involve quite a long expression.

Your query sql will be your version of this..

Update tablename set newfieldname =
dateserial(right(cstr(fieldname),4), mid(format(fieldname, "00000000"),3,2), left(format(fieldname, "00000000"),2))
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:gtmathewDallas
ID: 39253845
Thanks A Lot For This Perfect Answer.. It is working...
0
 

Author Comment

by:gtmathewDallas
ID: 39254020
I am sorry it worked but not in the desired format.. actually the date was in yyyymmdd (20130616) format and  I have to change to mm/dd/yyyy (06/16/2013). I tried with some changes in above code but not getting the result.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 39254205
The example you gave in your original Q does not look like yyyymmdd.

Update tablename set newfieldname =
dateserial(left(format(fieldname, "00000000"),4), mid(format(fieldname, "00000000"),3,2), right(format(fieldname, "00000000"),2))
0
 

Author Comment

by:gtmathewDallas
ID: 39254411
Yes It is working fine - I changed mid(format(fieldname, "00000000"),3,2) to mid(format(fieldname, "00000000"),5,2)
Thank You..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

726 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