Solved

Date format in CSV export

Posted on 2011-03-22
11
882 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
[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
  • 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
Industry Leaders: 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!

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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