Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Date format in CSV export

Posted on 2011-03-22
11
Medium Priority
?
901 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35191258
how are you exporting the query as csv?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 500 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
 
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

886 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