Solved

date format - MS Access 2010

Posted on 2013-06-17
7
705 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
  • 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help writing a query 6 73
Query to summarise data Like Pivot Table 3 29
Access Query based on a Form Field 2 21
subform is not filtered by link field 8 21
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

862 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now