A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

# of days between two dates



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2009, 05:47 PM posted to microsoft.public.access.queries
Jim[_49_]
external usenet poster
 
Posts: 13
Default # of days between two dates

Is there an expression that I can use in a query to determine the
number of days between two dates?
  #2  
Old August 21st, 2009, 06:27 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default # of days between two dates

DateDiff("d",earlydate, laterdate)

You might also be able to simply subtract one from the other.

--
Duane Hookom
Microsoft Access MVP


"Jim" wrote:

Is there an expression that I can use in a query to determine the
number of days between two dates?

  #3  
Old August 21st, 2009, 06:33 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default # of days between two dates

On Fri, 21 Aug 2009 09:47:02 -0700 (PDT), Jim wrote:

Is there an expression that I can use in a query to determine the
number of days between two dates?


DateDiff("d", [first date field], [second date field])

That's inclusive of the first date and the last date.
--

John W. Vinson [MVP]
  #4  
Old August 21st, 2009, 06:39 PM posted to microsoft.public.access.queries
Joe[_22_]
external usenet poster
 
Posts: 18
Default # of days between two dates

Hello Jim

Try to use the DateDiff function.

In a new saved query, in the design mode, right click a next empty column
and choose "Built" (I think this is the option in English version.).

In the Internal Functions, find DATEDIFF end fill up the fields.

By.

Joe





"Jim" escreveu na mensagem
...
Is there an expression that I can use in a query to determine the
number of days between two dates?



  #5  
Old August 21st, 2009, 08:27 PM posted to microsoft.public.access.queries
Krzysztof Naworyta
external usenet poster
 
Posts: 80
Default # of days between two dates

Juzer Jim napisal

| Is there an expression that I can use in a query to determine the
| number of days between two dates?

You can use DateDiff() function, as mentioned earlier, but...
remember that dates are just numbers od days from "zero" date
(in access: 1899-12-30)
So you can just subtract them:

xDays = Date2 - Date1
or
xDays = Int(DateTime2) - Int(DateTime1)

--
KN

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.