Thread: Ask for date
View Single Post
  #3  
Old November 25th, 2009, 05:13 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Ask for date

I have to convert date and time to local time with this function - convert:
dateadd("h",-8/24, [datetime]).
You do realize that -8/24 equals -1/3 or -.333333333 so you are changing
the datetime by .333333 hours.

Try using this --
DateValue(DateAdd("h",-8, [datetime]))
This removes the time from the DateTime.

--
Build a little, test a little.


"PhilT via AccessMonster.com" wrote:

I have a situation of asking user to input begin date and end date, but query
keeps give me all previous year. For instance, if I asked for 11/11/2009 to
11/19/2009, it included 11/11/2007 to 11/19/2007, 11/11/2008 to 11/19/2008,
and 11/11/2009 to 11/19/2009.

In table, I have datetime field in GMT. However, in query I have to convert
date and time to local time with this function - convert: dateadd("h",-8/24,
[datetime]). I put Between [begin] and [end] in the convert field.

If I put the Between [begin] and [end] in the datetime field, it queries
correctly.

What did I do wrong here?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200911/1

.