Specify criteria for a date/time field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I write the criteria for a field of the type date/time?

I want all records in a given time frame - e.g. from January 5, 8am to
January 7, 2pm
 
DianePDavies said:
How do I write the criteria for a field of the type date/time?

I want all records in a given time frame - e.g. from January 5, 8am to
January 7, 2pm

SELECT *
FROM TableName
WHERE FieldName BETWEEN #2006-01-05 8:00 AM# AND #2006-01-07 2:00 PM#

When time is involved a range is always subject to interpretation. When you
say "to January 7, 2pm" do you really mean that a record with exactly 2 PM
should be included and a record 1 second after 2 PM should NOT be included?
If so then the example I gave you would work. If you want record up to but
not including exactly 2 PM then I would use this instead...

SELECT *
FROM TableName
WHERE FieldName >= #2006-01-05 8:00 AM#
AND FieldName < #2006-01-07 2:00 PM#
 
Thanks - I knew there was some formatting issues... like the use of #.

Now - I want to show data in a chart, having the time interval on the x-axis
and the date on the y-axis. How is that easily done? Using the Chart-wizzard
is not exactly easy on this.
 
DianePDavies said:
Thanks - I knew there was some formatting issues... like the use of #.

Now - I want to show data in a chart, having the time interval on the
x-axis and the date on the y-axis. How is that easily done? Using the
Chart-wizzard is not exactly easy on this.

Sorry, but I can't even wrap my head around how a chart like that would even
look. You are trying to use the same field (just formatted differently) for
both axis?
 
no - I meant "data" on the y-axis...
--
Diane


Rick Brandt said:
Sorry, but I can't even wrap my head around how a chart like that would even
look. You are trying to use the same field (just formatted differently) for
both axis?
 
Back
Top