Export Date without Time to text tab delimited file

W

workweek

I need to export a table to a tab delimited text file. I have a date field
in the file. I need it to export as just the date without the time. I have
an input mask of short date on the field, but it still exports with the time.
Currently exports as 8/26/2008 00:00:00... Need to export as 8/26/2008.
 
J

Jerry Whittle

Create a query based on the table. Use the Format function to produce the
date as you like to see it. Export the returns from this new query instead of
the table.
 
K

Klatuu

Jerry's answer is correct, but to give you some additional info.
the Input Mask property has no effect on how data is stored in a field or
how it id displated. It is only used during data entry to assist a user in
entering a value correctly.
Also, if you are using Now() to populate the field, but you really only care
about the date, you should be using Date(). That is because any comparisons
you use on a date field that has times in it will likely be wrong if you
don't also include the time down to the second.

Note that all date fields do contain a time component, but the Date function
always returns midnight - 08/2702009 00:00:00 AM But, if you use Now, it
will include the time - 8/27/2008 4:00:39 PM

So, if you are looking for records for a date, say today's date:

SELECT * FROM SomeTable WHERE [MyDateField] = Date();
8/27/2008 4:00:39 PM not be included.
 
D

Dale Fye

You could also use the DateValue function (instead of Format() ) to get just
the date portion of the field value.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top