how to calculate the days between two dates excluding saturday and sunday

0

how to calculate the days between two dates excluding saturday and sunday
foe example if i am calculating the days between 14/12/2007 to 17/12/2007
the answer for no of days should be 4...
pls send the code for above problem.
advance thanks
hidash.

how to calculate the days between two dates excluding saturday and sunday
foe example if i am calculating the days between 14/12/2007 to 17/12/2007
the answer for no of days should be 2...
pls send the code for above problem.
advance thanks
hidash.

var date1 = new Date();
var date2 = new Date();
var diff = new Date();
diff.setTime(Math.abs(date1.getTime() - date2.getTime()));
return (diff.getTime() / (1000 * 60 * 60 * 24));

theres the basics given that date1, date2 are the dates you wish to compare

You can get it within +/- two days (no matter the length of the interval) just by integer-dividing the the output of the above formula by 7, and then multiplying by 5.

To refine it more, you need to know what day of the week each day is, and add or subtract up to two days, according to which days of the week each day is.

If the start and end dates are the same day of the week, no adjustment is needed.

Hello, how do i escape passing parameters to page where you need to give two parameters ID and category?
my sql is like this SELECT ID, Image, imageID, Category FROM gallery WHERE imageID={$imageID} AND Category='$category'
but i have a button which should show all pictures no matter what category they ...