Converting date from an external source

G

Guest

I am having an issued with converting a date from external data source. the
data has the timestamp in the general date form mm/dd/yyyy 00:00:00. I want
to convert the date to mm/dd/yyyy format so when i run a query for a single
day it will return the data for that date, I can currently return the data
but i have to set the parameter in the mm/dd/yyyy 00:00:00 format, i want to
simply return the data by setting the parameter in the mm/dd/yyyy format
 
P

Pat Hartman \(MVP\)

Don't confuse how data is stored with how it is presented. As long as you
import the date into a field defined as a Date data type, you can display it
in any format you choose. Be careful to not format a date too early in a
process because formatting a date will convert it to a string and a string
will not sort intelligently the way a data will.

To extract only the date part of a date/time field use the DateValue()
function. To extract only the time portion use the TimeValue() function.

Select ...
From ..
Where DateValue(YourDate) between Date() and Date()-7; --- to return
records within the past 7 days
 

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