By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,425 Members | 2,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,425 IT Pros & Developers. It's quick & easy.

Exporting Date() to a Text File without exporting the time too

P: 22
I am exporting a Query to a Text File. One of my fields is the current Date. F1:Date()

When I look at the text file, my date is displaying the System Date which includes the time.
Example: 10-29-2012 0:00:00

I only want to export the date portion but can't figure out how to get rid of the time portion.
Desired Result: 10-29-2012

In the query, I did try playing with the Field Properties with Format = Short Date and Input Mask = 99/99/0000, but this did not give me my Desired Result.

Any suggestions?
Oct 29 '12 #1

✓ answered by zmbd

Build a calculated field in the query using the following:format([field],"yyyy-MM-dd") this will take the date value in the [field] and convert it to the string... in this case something like "2012-10-29"
http://msdn.microsoft.com/en-us/libr.../gg251755.aspx

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,494
Use a string value from the Format() function. The Format property of a non-string field is only used in certain circumstances where humans are involved and doesn't change the fact that the field is intrinsically a Date/Time field. The value returned by the Format() function, on the other hand, is not a Date at all, but a string. Exactly what you require :-)
Oct 30 '12 #2

zmbd
Expert Mod 5K+
P: 5,397
Build a calculated field in the query using the following:format([field],"yyyy-MM-dd") this will take the date value in the [field] and convert it to the string... in this case something like "2012-10-29"
http://msdn.microsoft.com/en-us/libr.../gg251755.aspx
Oct 30 '12 #3

zmbd
Expert Mod 5K+
P: 5,397
Most Welcome...
That little format function is really usefull once the formating strings are mastered... take notice of the "sections" within the formatting string (about 1/2 thru the link) they will become usfull in alot of situations.
Oct 30 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.