Page 1 of 1

How many Wednesday and Friday

Posted: Fri Mar 12, 2010 3:43 am
by mariolopes
Hi
I need to know how many Wednesday and Friday exists between two dates. Any help?
Thank you

Re: How many Wednesday and Friday

Posted: Fri Mar 12, 2010 7:20 am
by requinix
What have you tried? What do you have now?

Re: How many Wednesday and Friday

Posted: Fri Mar 12, 2010 7:26 am
by cpetercarter
I think you can work out for yourself how to do it.

Useful building blocks include:

mktime() turns a date/time into a Unix timestamp

date() can return all sorts of useful information about a timestamp, including the day of the week.

Unix timestamps represent the number of seconds since 1 Jan 1970. Subtracting one timestamp from another gives you the number of seconds between two dates. Dividing this difference by (60*60*24) gives you the number of days; dividing by (60*60*24*7) gives you the number of weeks.

Over to you.