Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Dates based on number of days in month

Status
Not open for further replies.

scon165

Technical User
Dec 27, 2001
7
US
I am trying to calculate two date fields to get the number of days between. My report will pull patients that were either admitted or discharged within the data range specified. If I choose January as the month I am looking at, I will have some records that will show patients admitted prior to Jan and discharged after Jan. I only want to count the days in Jan. My formula is basically End_dt - Start_dt I will get 30, but there are 31 days in Jan. How do I get all of the days in the month? I know this will change based on the month chosen.
 
You'd be better served to post example data and expected output.

To determine the number of days between 2 dates, use:

datediff("d",{table.startdate}, {table.enddate})

To determine the number of days in the month for any supplied date, use:

dateadd("m",1,{table.date})-(day(dateadd("m",1,{table.date})))

Hope something here helped.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top