timestamp handle

R

R Walle

I have a database automatically created for a GE SCADA software, it creates
a table with datalogging from the proccess , one column for each datafield is
being logged and a [timestamp] field formated (mm/dd/aaaa hh:mm:ss) now I
want to make some reports based on dates ranges lets say by days or mounths
, but since timestamp is deep to seconds if I use a date(dd/mm/aaaa) as query
parameter / filter I get no query results Im afraid because timestamp data
formating even if I formating this timestamp field to display short date or
any other date format the result is te same , any idea about handle this
[timestamp] field ?

Tks in advance for your help
Raymundo Walle
 
D

Douglas J. Steele

You need to use

WHERE [TimestampField] BETWEEN [MyDateValue] AND DateAdd("s", 86399,
[MyDateValue])

The alternative (which is much less efficient, since the function needs to
be applied to each row) is

WHERE DateValue([TimestampField]) = [MyDateValue]
 
J

John Spencer

I would just use
WHERE TimeStampField <= [DateValue] and TimeStampField < [DateValue]+1

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
J

John Spencer

Well, that was just a repeat of Douglas Steele's advice. I need to read more
carefully.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

John said:
I would just use
WHERE TimeStampField <= [DateValue] and TimeStampField < [DateValue]+1

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
You need to use

WHERE [TimestampField] BETWEEN [MyDateValue] AND DateAdd("s", 86399,
[MyDateValue])

The alternative (which is much less efficient, since the function
needs to be applied to each row) is

WHERE DateValue([TimestampField]) = [MyDateValue]
 
D

Douglas J. Steele

Actually, you need to type more carefully too. <g>

I believe you meant to say

WHERE TimeStampField >= [DateValue] and TimeStampField < [DateValue]+1


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


John Spencer said:
Well, that was just a repeat of Douglas Steele's advice. I need to read
more carefully.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

John said:
I would just use
WHERE TimeStampField <= [DateValue] and TimeStampField < [DateValue]+1

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
You need to use

WHERE [TimestampField] BETWEEN [MyDateValue] AND DateAdd("s", 86399,
[MyDateValue])

The alternative (which is much less efficient, since the function needs
to be applied to each row) is

WHERE DateValue([TimestampField]) = [MyDateValue]
 
J

John Spencer

That also. Sometimes I can't win. Sometimes I can.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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