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  

date functions



 
 
Thread Tools Display Modes
  #1  
Old May 1st, 2007, 05:58 PM posted to microsoft.public.access.queries
Mitchell_Collen via AccessMonster.com
external usenet poster
 
Posts: 58
Default date functions

Does anybody know how to calculate dates? I believe that it can be done
however, I am not sure where to start.

I have admit date and discharge date on several hundred records. I need to
get the number of days between admit date and discharge date per record_id.

Select admit_date, discharge_date and record_id, (convert(admit_date) +
convert(disharge_date)) As number_days
From subject
group by record_id;

This is not working. I believe that I am going about this totally wrong
according to the error messages generaed.

Any advice is welcome and appreciated.

Thanks, Mitchell

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

  #2  
Old May 1st, 2007, 06:19 PM posted to microsoft.public.access.queries
Rick Brandt
external usenet poster
 
Posts: 4,354
Default date functions

Mitchell_Collen via AccessMonster.com wrote:
Does anybody know how to calculate dates? I believe that it can be
done however, I am not sure where to start.

I have admit date and discharge date on several hundred records. I
need to get the number of days between admit date and discharge date
per record_id.

Select admit_date, discharge_date and record_id, (convert(admit_date)
+ convert(disharge_date)) As number_days
From subject
group by record_id;

This is not working. I believe that I am going about this totally
wrong according to the error messages generaed.

Any advice is welcome and appreciated.

Thanks, Mitchell


There is a function named DateDiff(). In your case...

DateDiff("d", admit_date, disharge_date)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #3  
Old May 1st, 2007, 06:31 PM posted to microsoft.public.access.queries
Mitchell_Collen via AccessMonster.com
external usenet poster
 
Posts: 58
Default date functions

Rick Brandt wrote:
Does anybody know how to calculate dates? I believe that it can be
done however, I am not sure where to start.

[quoted text clipped - 14 lines]

Thanks, Mitchell


There is a function named DateDiff(). In your case...

DateDiff("d", admit_date, disharge_date)

Thanks so much. I wasn't sure of the correct way to use that.

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

 




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 04:33 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.