How many Wednesday and Friday

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

How many Wednesday and Friday

Post by mariolopes »

Hi
I need to know how many Wednesday and Friday exists between two dates. Any help?
Thank you
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How many Wednesday and Friday

Post by requinix »

What have you tried? What do you have now?
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: How many Wednesday and Friday

Post 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.
Post Reply