Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change date format in query

Status
Not open for further replies.

mtdew

Technical User
Dec 9, 2007
77
US
Is it possible to change a date format from:

yyyy-mm-dd 00:00:00 to mm/dd/yy

in a query? And also to have the today's date in the field if the field is empty?

The data is linked to an Excel file so I'm not able to make changes from within Access. So would that prevent the query from changing the format or data in the field prior to placing it in a new table?
 


hi,

Dates are PURE NUMBERS.

What in your query, do you need to change the format?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
The field is in the format yyyy-mm-dd 00:00:00 but when I run the query and append the records to another database the format needs to be mm/dd/yy.
 



Well, if it is really a date, then the format is simply a display issue, related to the FIELD that the appended data is in.

Check the Data Type of that field.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Have you tried using Format? This will change the output on the query.

Code:
Select your_table.your_date
From your_table
Format([your_date],"MM/DD/YY")

 
Dhookom,

You are absolutely correct. My apologies. I should of taken the time to make sure that it would work in a query.

This works:

Code:
SELECT Format([your_date],"MM/DD/YY") AS [TheDate]
FROM your_table;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top