Solved

Date format in CSV export

Posted on 2011-03-22
11
865 Views
Last Modified: 2012-05-11
From an Access database, I am exporting the result of a Query, as XLS (Excel) and also as a CSV file. The Excel dates come out correctly, e.g. "22/03/2011", but the CSV dates also give the time part  which I don't want, e.g. " 22/03/2011 00:00:00". I just want "22/03/2011" in the CSV as well. Any idea how I can fix this? Thanks.
0
Comment
Question by:DataTrain
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35190855
in your query, change the date column to

dateValue([dateField])
0
 

Author Comment

by:DataTrain
ID: 35191235
Thanks for the suggestion but that doesn't make any difference.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35191258
how are you exporting the query as csv?
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 35191346
Actually, if you formatted the cells as date/time, they probably would also show the time part.
Please post your query SQL.
0
 
LVL 12

Accepted Solution

by:
telyni19 earned 125 total points
ID: 35191708
Try Format([DateField],"mm/dd/yyyy") for your query's date column definition. That should export the date as formatted text.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Expert Comment

by:MeLindaJohnson
ID: 35191854
I think you want format([datefield]. "dd/mm/yyyy")
0
 
LVL 4

Expert Comment

by:MeLindaJohnson
ID: 35191860
should be a comma after [datefield] in post before.
0
 

Author Comment

by:DataTrain
ID: 35191892
I don't believe the SQL is the issue as the date format it generates is correct and the XLS output is also correct. So I think it is something to do with the export to CSV. This is the command I am using: DoCmd.TransferText acExportDelim, , stqueryname, strSaveFileName
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35191939
dataTrain, try the Format suggestion by telyni19, that should do it..
0
 
LVL 4

Expert Comment

by:MeLindaJohnson
ID: 35191976
If you want days, months, year then "dd/mm/yyyy".  If you want months, days, year then use "mm/dd/yyyy".  Your example shows days,month,year.

...copied from above....  I just want "22/03/2011" in the CSV as well.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35192020
FYI.
MeLindaJohnson,
you are basically repeating another experts earlier post at http:#a35191708
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

762 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

23 Experts available now in Live!

Get 1:1 Help Now