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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating indivdiual days between two dates

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
0
0
AU
Hello,

Just need some ideas on how to find the number of individual days between two dates.
for eg; Start date 1st April 2013, End date Dec 1st 2013
How many Mondays, Tuesdays etc.

Many thanks,
Integrity
 
Are you including the StartDate and EndDate in your count?

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Hi Missinglinq,

Yes I do want to include the Start date and end date

Regards,

Integrity
 
Then you should be set, using Michel Walsh's code that Allan gave you the link for, calling the Function for each day of the week, where the WD in the parameters of the Function is the numerical representation of the day of the week desired, i.e.

Sunday = 1
Monday = 2
Tuesday= 3

...and so forth.

So, the calling code would be something like this

Code:
"GivenWeekdays = " & HowManyWD([StartDate], [EndDate], [b][i][COLOR=#EF2929]X[/color][/i][/b])

And to calculate the days

Code:
"Sundays = " & HowManyWD([StartDate], [EndDate], [b][i][COLOR=#EF2929]1[/color][/i][/b])
"Mondays = " & HowManyWD([StartDate], [EndDate], [b][i][COLOR=#EF2929]2[/color][/i][/b])
"Tuedays = " & HowManyWD([StartDate], [EndDate], [b][i][COLOR=#EF2929]3[/color][/i][/b])

and so on.

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Thanks Guys.

Thank you for that code link and the code function.
Could I have some help with implementing this on a form please.
Have spent some time looking at how to get this to work, by so far no go.

Many thanks,

Integrity
 
What is it you want to display on the form?

(RG for short) aka Allan Bunch MS Access MVP acXP, ac07 ac10 ac13 - winXP Pro, Win7 Pro
Please respond to this forum so all may benefit
 
integritycare,
Your first step is to create a new standard module and copy the functions into the module. Save the module with a name like "modDateFunctions".

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top