Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 28th, 2004, 11:41 PM
Registered User
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to calculate the work days beetwen two dates.


I need to calculate the difference beetwen two dates, without the weekend (Saturday and Sunday) to display only the "Work" days.

For example:

Date 1: 29/09/2004
Date 2: 05/10/2004
Work days: 5 days

Anybody knows how to do this?


Old October 7th, 2004, 06:23 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi

Here is the code...

function DayCount()
   var d1 = new Date(2004,09,29);
   var d2 = new Date(2004,10,05);
   var flag=true;
   var day,daycount=0;
      if(day != 0 && day != 6)
      d1.setDate(d1.getDate()+1) ;
      if(d1.getDate() == d2.getDate() &&
                  d1.getMonth()== d2.getMonth())
document.write("Work Day COunt"+daycount);

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to query dates after 90 days old melkin SQL Language 9 October 30th, 2007 08:03 AM
Calculate # of work days ? kscase SQL Server 2005 3 June 9th, 2007 09:11 PM
How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM
Calculating number of days between multiple dates Vann Access 4 December 3rd, 2004 08:26 PM
Calculate Business Days - MS access 97 snoopy92211 Access VBA 0 October 13th, 2004 02:13 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.