Solved

Date format in CSV export

Posted on 2011-03-22
11
872 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
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.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…

831 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