/    Sign up×
Community /Pin to ProfileBookmark

Help Customizing Script to Subtract Business Days from Current Date

Hi all, I’m working on something for my job that requires a script that will display a date x number of business days in the past. (Actually two scripts – one for 3 business days ago, and one for 8 business days ago – but I just need to get one of them done, and I’ll be set!!) I found a script online that will count days in the FUTURE and skip weekends, however, when I tried to modify it to count backwards, it no longer skips weekend days. ? Can someone take a look at my Franken-Script and let me know if I forgot to change a setting or something that will allow it to count backwards and NOT include weekend days? It displays in the format I want already, but it can look as pretty as it wants – it won’t help if the date is wrong! ?

For example, the script below, when run today (Feb 2), returns January 25 – 8 days ago – instead of January 23 – 8 BUSINESS days ago.

<script language=JavaScript>
function getNextBusinessDay() {
return getDeliveryDateObj(-8);
}

function getDeliveryDateObj(businessDaysLeftForDelivery) {
var now = new Date();
var dayOfTheWeek = now.getDay();
var calendarDays = businessDaysLeftForDelivery;
var deliveryDay = dayOfTheWeek + businessDaysLeftForDelivery;
if (deliveryDay >= 6) {
businessDaysLeftForDelivery -= 6 – dayOfTheWeek; //deduct this-week days
calendarDays += 2; //count this coming weekend
deliveryWeeks = Math.floor(businessDaysLeftForDelivery / 5); //how many whole weeks?
calendarDays += deliveryWeeks * 2; //two days per weekend per week
}
now.setTime(now.getTime() + calendarDays *
24 * 60 * 60 * 1000);
return now;
}

var now = getNextBusinessDay();

var months = new Array(‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’);

var date = ((now.getDate()<10)? “0” : “”)+ now.getDate();

daymonth = months[now.getMonth()]
wkday = date

document.write(“<p align=center><b><font face=Verdana size=1 color=blue>”);
document.write(daymonth);
document.write(“</font><br><font face=Verdana size=6 color=blue>”);
document.write(wkday);
document.write(“</font></b></p>”);
</script>

to post a comment
JavaScript

20 Comments(s)

Copy linkTweet thisAlerts:
@mjdamatoFeb 02.2007 — One question. What do you want to happen if "today" is not a business day?

for example, if "today" was Friday and you wanted to count back 3 days you get Tuesday. But if "today" is Sat , do you want it to return Tuesday or Wednesda. In otherwords, do you want it treated as Friday or Monday? I would guess Monday, but want to be sure.
Copy linkTweet thisAlerts:
@rwest81authorFeb 02.2007 — Well, I'm not thinking that's going to be an issue... Our agents only work Monday through Friday, and are only on the site those days. But I guess for the sake of the question, "today" being a weekend day would be best treated as a Monday.
Copy linkTweet thisAlerts:
@mrhooFeb 02.2007 — This function will return the Date that is [B]n[/B] business days from today.

If you pass a negative number, it will return a Date [B]n[/B] business days in the past.

You could adapt it for your script- restrict the input, format the return to a string, account for holidays, add a day if the time is after business hours, whatever.

[CODE]function businessDays(n){
var D=new Date();
var num=Math.abs(n);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}[/CODE]

sample uses:

var D=businessDays(-3).toLocaleDateString(); //string

var D=businessDays(8); //object
Copy linkTweet thisAlerts:
@mjdamatoFeb 02.2007 — Well, my script is a little longer than mrhoo's but I think it is more efficient as it does not need to loop through every day. Just pass it the number of business days to adjust from today: positive or negative.

function getDeliveryDateObj(businessDays) {
businessDays = Math.abs(businessDays);
var now = new Date();
var dayOfTheWeek = now.getDay();

if (dayOfTheWeek==0 || dayOfTheWeek==6) { //adjust if start date is a weekend
dayOfTheWeek=(businessDays&lt;0)?1:5;
}

weeks = (businessDays/5);

if (businessDays&gt;0) { //Business days in the future
wholeWeek = Math.floor(weeks);
partsWeek = businessDays-(wholeWeek*5);
if ((dayOfTheWeek+partsWeek)&gt;5) { partsWeek += 2; }
}

if (businessDays&lt;0) { //Business days in the past
wholeWeek = Math.ceil(weeks);
partsWeek = businessDays-(wholeWeek*5);
if ((dayOfTheWeek+partsWeek)&lt;1) { partsWeek -= 2; }
}

var daysToMove = partsWeek + (wholeWeek * 7);
now.setTime(now.getTime() + daysToMove * 24 * 60 * 60 * 1000);

return now;
}


However, mrhoo's script could be modified to account for holidays. You could create an array of the holidays that should not be counted as business days and have those skipped as well.
Copy linkTweet thisAlerts:
@mrhooFeb 02.2007 — You may want to find the date n business days before or after some arbitrary date-

10 business days after the first of the month, say.

If so, pass the function a second argument for the starting Date.

And I included a skeleton for holiday checking...

[CODE]function businessDays(n,D){
D= D || new Date();
var num=Math.abs(n);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}[/CODE]

[CODE]Date.prototype.isHoliday=function(){
var A=[this.getMonth()+1,this.getDate()]
var hol={
'Christmas':[12,25],
'GroundHogDay':[2,2]
}
var tem;
for(var p in hol){
tem= hol[p];
if(A[0]==tem[0] && A[1]==tem[1]) return p;
}
return false;
}[/CODE]
Copy linkTweet thisAlerts:
@rwest81authorFeb 05.2007 — Wow, thanks both of you for all your help!!!!! I'm using mjdamato's for now since it's pretty much grab-n-go (THANKYOUTHANKYOUTHANKYOU), but I'm going to play around with what mrhoo gave me as well to see if I can't get some holidays programmed in there as well!!!! That would also be a wonderful feature so I wouldn't have to remember to account for them later!

Again, guys, [B][I]I can't thank you enough for all your help[/I][/B]!!!! ? I would give you both a cookie if I could! ?
Copy linkTweet thisAlerts:
@nbkcu33Aug 07.2013 — I am new to JavaScript and I have been looking at mrhoo's script. I have a test page where I am seeing how to manipulate the script to account for dates in the post and how to select a date to calculate from.

I have replace (n) in the line var num=Math.abs with a negative number and I only get today&#8217;s date.

I have also replaced D.getDate with a variable and the script returns "undefined".

Can anyone please shed a little light on my issues?
Copy linkTweet thisAlerts:
@007JulienAug 07.2013 — To work with holidays. It's possible to build javascript files for each years with PHP with something like this (the date('z',$timestamp) function give the day of year from 0 to 365)

(the datas are made for France where holidays are : 1er janvier, 1er et 8 mai, lundi de Pâques, lundi de Pentecôte, 14 juillet, 15 août, 1er novembre, 11 novembre et 25 décembre Noël.

[CODE]$vcs=str_repeat("000000",61);// a string with 366 zeros
$vcs[0]=1; // 1er janvier
$vcs[date('z',easter_date($year)+129600)]=1;// Lundi Pâques
$vcs[date('z',easter_date($year)+38*86400+129600)]=1; // Ascension
$vcs[date('z',easter_date($year)+49*86400+129600)]=1;// Pentecôte
$vcs[date('z',mktime(12,0,0,5,1,$year))]=1; // 1er mai
$vcs[date('z',mktime(12,0,0,5,8,$year))]=1; // 8 mai
$vcs[date('z',mktime(12,0,0,7,14,$year))]=1;// 14 juillet
$vcs[date('z',mktime(12,0,0,8,15,$year))]=1;// 15 août
$vcs[date('z',mktime(12,0,0,11,1,$year))]=1;// 1er novembre
$vcs[date('z',mktime(12,0,0,11,11,$year))]=1;// 11 novembre
$vcs[date('z',mktime(12,0,0,12,25,$year))]=1;// 25 décembre

$cnt = 'var hdy="'.$vcs.'";
file_put_content('hollidays2013.js',cnt);
[/CODE]


Then with javascript this prototype allows to test if a date is a hollidays ( hdy.substr(dayOfYear,1) is true)

[CODE]Date.prototype.getDayOfYear=function(){var a=this.getFullYear(),m=this.getMonth()+1,r=this.getDate();
while(--m) {r+=new Date(a,m,0).getDate();}
return r-1;
}; [/CODE]


Since we use calendar on this form
Copy linkTweet thisAlerts:
@nbkcu33Aug 08.2013 — I understand how to build out the holiday array.

My question is how would incorporate “datetimepicker css.js” into this script to allow users to select their own date. I need to and calculate the date 10 business days, including holidays, in the future and in the past from the date the user selects.
Copy linkTweet thisAlerts:
@nbkcu33Aug 09.2013 — Allow me to provide some additional information. I have a need to calculate 10 and 30 business days in the future and into the past form both "today&#8217;s date" and a date selected by the user.

My code follows:

<title>Business Days from Today's Date</title>

<script src="datetimepicker_css.js"></script>

<style type="text/css">

.style2 {

text-align: center;

}

.style3 {

color: #0d2bcc;

}

</style>

</head>

<body>

<fieldset style="width: 314px">

<legend class="style3"><span class="style2"><strong><em>Business Days from Today's Date</em></strong></span></legend>

<body onload="businessDays2()"></body>

<SCRIPT LANGUAGE="JavaScript">
function businessDays10(n,D){
D = D || new Date();
var num=Math.abs(10);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}
function businessDaysM10(n,D){
D = D || new Date();
var num=Math.abs(10);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}

Date.prototype.isHoliday=function(){
var A=[this.getMonth()+1,this.getDate()]
var hol={ //Manually update Holiday Dates
'New Years Day':[1,1,2013],
'Martin Luther King, Jr. Day':[1,21,2013],
'Presidents&#8217; Day':[2,18,2013],
'Memorial Day':[5,27,2013],
'Independence Day':[7,4,2013],
'Labor Day':[9,2,2013],
'Columbus Day':[10,14,2013],
'Veterans Day':[11,11,2013],
'Thanksgiving Day':[11,28,2013],
'Christmas':[12,25,2013]
}
var tem;
for(var p in hol){
tem= hol[p];
if(A[0]==tem[0] && A[1]==tem[1]) return p;
}
return false;
}

</script>

<span class="style3"><strong><em>Future CALENDAR Dates</em></strong></span><br>
10 Business Days =
<SCRIPT LANGUAGE="JavaScript">
var str = (businessDays10().toLocaleDateString())
document.write (str.fontsize(3))
</script>

<br>

<br>


<span class="style3"><strong><em>Past CALENDAR Dates</em></strong></span><br>

10 Business Days =

<SCRIPT LANGUAGE="JavaScript">

var str = (businessDaysM10(-10).toLocaleDateString())

document.write (str.fontsize(3))

</script>

</fieldset>

<SCRIPT LANGUAGE="JavaScript">

var InputDate;
var SelectDate;
var numDays;
var getDate;
var newDate

var Edate30
var bDate10

EnumDays0 = 0
EnumDays30 = 2592000 //(30 days) 2629743 (1 month=30.44 Days)

function addDate30(dateObject, numDays30) {
dateObject.setDate(dateObject.getDate() + numDays30);
return dateObject.toLocaleDateString();
}


var EdateM30

EnumDaysM30 = -2592000

function addDatem30(dateObject, numDaysm30) {
dateObject.setDate(dateObject.getDate() + numDaysm30);
return dateObject.toLocaleDateString();
}

oldDate = new Date();
oldDate1 = new Date();

numDays30 = 30;

newDate30 = addDate30(oldDate1, numDays30);

function SelectedDate (InputDate, EnumDays) {

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays0);
Edate0 = new Date (SelectDate *1000);
var eDate0 = (Edate0.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays30);
Edate30 = new Date (SelectDate *1000);
var eDate30 = (Edate30.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM30);
EdateM30 = new Date (SelectDate *1000);
var eDateM30 = (EdateM30.toLocaleDateString());

oldDateM = new Date();
oldDateM1 = new Date();


numDaysM30 = -(30);


newDateM30 = addDatem30(oldDateM1, numDaysM30);


alert(("The date you selected is " + eDate0) + ("nnFUTURE CALENDAR DATES from your selected date:n30 Days is "+ eDate30) + ("nnPAST CALENDAR DATES from your selected date:n30 Days is ")+ eDateM30);

}

</script>

<br>

<fieldset style="height: 70px; width: 316px;" class="style4">

<FORM NAME="myform" style="width: 308px">

<legend class="style3"><span class="style2"><strong><em>Calculate from Your Own Date</em></strong></span></legend>

<input type="Text" NAME="InputDate" class="style1" onchange="SelectedDate(this.form)" value="Select a Date">

<img src="cal.gif" onclick="javascript:NewCssCal('InputDate','mmddyyyy','arrow')" style="cursor:hand"><br>

<input type="reset" value="Reset Calendar">

</html>

All of the calendar date calculations for correctly but the 10 business days in the past returns &#8220;today&#8217;s date&#8221; and I can&#8217;t get the selected date to pass to the business day calculator.

I hope this clarifies everything that I am trying to accomplish.
Copy linkTweet thisAlerts:
@007JulienAug 09.2013 — Don't use 86400. With dayligth saving time all days are not 86400 secondes ! Its a very rare error cause, but a common misstake !

Prefers always your right form :
[CODE]dateObject.setDate(dateObject.getDate() + numDay);[/CODE]

NB : Please insert your script in *[* CODE *]* *[* / CODE *]* (whitout * and spaces) tags or click on the button [I]Go Advanced[/I] to use the button [B]<>[/B]
Copy linkTweet thisAlerts:
@nbkcu33Aug 09.2013 — So here is my complete script. When the script is run it displays 4 sections:

Section 1 - today's date

2 - business days from today's date

3 - calendar dates calculated from today's daye

4 - select any date to calculate from.

My problems are:

I need to get the user's selected date to pass to the Business day calculator and Alert the correct dates.

If I do not use 86400 seconds per day I would I calculate 30, 45, 60 and 90 daysin the future and past.

I am sorry if you have explained how I would accomplish this alreay, but I do not understand.


[CODE]
<html lang="en">
<head>
<META name="WebPartPageExpansion" content="full">
<title>Date Calculator</title>
<script src=\"datetimepicker_css.js"></script>
<style type="text/css">
.style1 {
margin-top: 0px;
}
.style2 {
text-align: center;
}
.style3 {
color: #0d2bcc;
}
.style4 {
margin-bottom: 0px;
}
.style5 {
text-align: left;
}
.style6 {
color: #FFFFFF;
}
</style>
</head>
<body>
<table border="0" cellpadding="3"><td valign="top" style="width: 450px">
<fieldset>
<legend class="style3"><span class="style2"><strong><em>CALENDAR DATE CALCULATOR</em></strong></span></legend>
<div class="style2">

<fieldset>
<legend class="style3"><span class="style2"><strong><em>Today's Date</em></strong></span></legend>
<script type="text/javascript" >
var t = new Date();
var ldt = t.toLocaleDateString();
document.write(ldt.bold())
</script>
</fieldset>


<fieldset>
<legend class="style3"><span class="style2"><strong><em>Business Days from Today's Date</em></strong></span></legend>
<body onload="businessDays2()"></body>

<SCRIPT LANGUAGE="JavaScript">
function businessDays2(n,D){
D = D || new Date();
var num=Math.abs(2);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}
function businessDays10(n,D){
D = D || new Date();
var num=Math.abs(10);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}
function businessDaysM2(n,D){
D = D || new Date();
var num=Math.abs(-2);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}
function businessDaysM10(n,D){
D = D || new Date();
var num=Math.abs(-10);
var tem,count=0;
var dir= (n<0)? -1: 1;
while(count< num){
D= new Date(D.setDate(D.getDate()+dir));
if(D.isHoliday())continue;
tem=D.getDay();
if(tem!=0 && tem!=6) ++count;
}
return D;
}
Date.prototype.isHoliday=function(){
var A=[this.getMonth()+1,this.getDate()]
var hol={ //Manually update Holiday Dates
'New Years Day':[1,1,2013],
'Martin Luther King, Jr. Day':[1,21,2013],
'Presidents’ Day':[2,18,2013],
'Memorial Day':[5,27,2013],
'Independence Day':[7,4,2013],
'Labor Day':[9,2,2013],
'Columbus Day':[10,14,2013],
'Veterans Day':[11,11,2013],
'Thanksgiving Day':[11,28,2013],
'Christmas':[12,25,2013]
}
var tem;
for(var p in hol){
tem= hol[p];
if(A[0]==tem[0] && A[1]==tem[1]) return p;
}
return false;
}
</script>
<span class="style3"><strong><em>Future Dates</em></strong></span><br>
2 Business Days =
<SCRIPT LANGUAGE="JavaScript">
var str = (businessDays2(2).toLocaleDateString())
document.write (str.fontsize(3))
</script>
<br>
10 Business Days =
<SCRIPT LANGUAGE="JavaScript">
var str = (businessDays10(10).toLocaleDateString())
document.write (str.fontsize(3))
</script>
<br>
<br><span class="style3"><strong><em>Past Date</em></strong></span><br>
10 Business Days =
<SCRIPT LANGUAGE="JavaScript">
var str = (businessDaysM10(-10).toLocaleDateString())
document.write (str.fontsize(3))
</script>
</fieldset>

<fieldset>
<strong>
<legend class="style3"><span class="style2"><strong><em>Calculated Dates from Today's Date</em></strong></span></legend>
</strong>

<SCRIPT LANGUAGE="JavaScript">
var InputDate;
var SelectDate;
var numDays;
var getDate;
var newDate

var Edate30
var Edate45
var Edate60
var Edate90

EnumDays0 = 0
EnumDays30 = 2592000 //(30 days) 2629743 (1 month=30.44 Days)
EnumDays45 = 3888000 //(45 days)
EnumDays60 = 5184000 //(60 Days) 5259486 (60.87 Days)
EnumDays90 = 7776000 //(90 Days) 7819200 (90.5 Days)

function addDate30(dateObject, numDays30) {
dateObject.setDate(dateObject.getDate() + numDays30);
return dateObject.toLocaleDateString();
}

function addDate45(dateObject, numDays45) {
dateObject.setDate(dateObject.getDate() + numDays45);
return dateObject.toLocaleDateString();
}

function addDate60(dateObject, numDays60) {
dateObject.setDate(dateObject.getDate() + numDays60);
return dateObject.toLocaleDateString();
}

function addDate90(dateObject, numDays90) {
dateObject.setDate(dateObject.getDate() + numDays90);
return dateObject.toLocaleDateString();
}

var EdateM30
var EdateM45
var EdateM60
var EdateM90

EnumDaysM30 = -2592000
EnumDaysM45 = -3888000
EnumDaysM60 = -5184000
EnumDaysM90 = -7776000

function addDatem10(dateObject, numDaysm10) {
dateObject.setDate(dateObject.getDate() + numDaysm10);
return dateObject.toLocaleDateString();
}

function addDatem30(dateObject, numDaysm30) {
dateObject.setDate(dateObject.getDate() + numDaysm30);
return dateObject.toLocaleDateString();
}

function addDatem45(dateObject, numDaysm45) {
dateObject.setDate(dateObject.getDate() + numDaysm45);
return dateObject.toLocaleDateString();
}

function addDatem60(dateObject, numDaysm60) {
dateObject.setDate(dateObject.getDate() + numDaysm60);
return dateObject.toLocaleDateString();
}

function addDatem90(dateObject, numDaysm90) {
dateObject.setDate(dateObject.getDate() + numDaysm90);
return dateObject.toLocaleDateString();
}

oldDate = new Date();
oldDate1 = new Date();
oldDate2 = new Date();
oldDate3 = new Date();
oldDate4 = new Date();

numDays30 = 30;
numDays45 = 45;
numDays60 = 60;
numDays90 = 90;

newDate30 = addDate30(oldDate1, numDays30);
newDate45 = addDate45(oldDate2, numDays45);
newDate60 = addDate60(oldDate3, numDays60);
newDate90 = addDate90(oldDate5, numDays90);

function SelectedDate (InputDate, EnumDays) {

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays0);
Edate0 = new Date (SelectDate *1000);
var eDate0 = (Edate0.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays30);
Edate30 = new Date (SelectDate *1000);
var eDate30 = (Edate30.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays45);
Edate45 = new Date (SelectDate *1000);
var eDate45 = (Edate45.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays60);
Edate60 = new Date (SelectDate *1000);
var eDate60 = (Edate60.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays90);
Edate90 = new Date (SelectDate *1000);
var eDate90 = (Edate90.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM30);
EdateM30 = new Date (SelectDate *1000);
var eDateM30 = (EdateM30.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM45);
EdateM45 = new Date (SelectDate *1000);
var eDateM45 = (EdateM45.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM60);
EdateM60 = new Date (SelectDate *1000);
var eDateM60 = (EdateM60.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM90);
EdateM90 = new Date (SelectDate *1000);
var eDateM90 = (EdateM90.toLocaleDateString());

alert(("The date you selected is " + eDate0) + ("nnFUTURE CALENDAR DATES from your selected date:n30 Days is "+ eDate30) + ("n45 Days is ")+ eDate45 + ("n60 Days is ")+ eDate60 + ("n90 Days is ")+ eDate90 + ("nnPAST CALENDAR DATES from your selected date:n30 Days is ")+ eDateM30 + ("n45 Days is ")+ eDate45 + ("n60 Days is ")+ eDate60 + ("n90 Days is ")+ eDateM90);
}

oldDateM = new Date();
oldDateM1 = new Date();
oldDateM2 = new Date();
oldDateM3 = new Date();
oldDateM4 = new Date();

numDaysM30 = -(30);
numDaysM45 = -(45);
numDaysM60 = -(60);
numDaysM90 = -(90);

newDateM30 = addDatem30(oldDateM1, numDaysM30);
newDateM45 = addDatem45(oldDateM2, numDaysM45);
newDateM60 = addDatem60(oldDateM3, numDaysM60);
newDateM90 = addDatem90(oldDateM5, numDaysM90);

</script>

<span class="style3"><strong><em>Future Dates</em></strong></span><br>
<SCRIPT LANGUAGE="JavaScript">
document.write("30 days = " + newDate30 + "");//using computer date
document.write("<br>45 days = " + newDate45 + "");
document.write("<br>60 days = " + newDate60 + "");
document.write("<br>90 days = " + newDate90 + "");
</script>

<br><br><span class="style3"><strong><em>Past Dates</em></strong></span>
<SCRIPT LANGUAGE="JavaScript">
document.write("<br>30 days = " + newDateM30 + "");//using computer date
document.write("<br>45 days = " + newDateM45 + "");
document.write("<br>60 days = " + newDateM60 + "");
document.write("<br>90 days = " + newDateM90 + "");
</SCRIPT>
</fieldset>

<fieldset style="height: 70px" class="style4">
<FORM NAME="myform">
<legend class="style3"><span class="style2"><strong><em>Calculate from Your Own Date</em></strong></span></legend>
<input type="Text" NAME="InputDate" class="style1" onchange="SelectedDate(this.form)" value="Select a Date">
<img src=\"cal.gif" onclick="javascript:NewCssCal('InputDate','mmddyyyy','arrow')" style="cursor:hand"><br>
<input type="reset" value="Reset Calendar">

</form>

[/CODE]
Copy linkTweet thisAlerts:
@JMRKERAug 09.2013 — Here is a different take on your problem.


Note, you did not supply code for the datepicker script, so I left that out.

Also, your code looks a bit dated as the use of 'language="Javascript"' is deprecated

and you should not use document.write unless it is for initial code testing only as it may also go the way of the dodo soon.
<i>
</i>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt; Fixed &amp; Variable Holidays &lt;/title&gt;
&lt;meta charset="utf-8"&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id="debugDIV"&gt;&lt;/div&gt;

&lt;script type="text/javascript"&gt;

// From post #6 of
// http://www.webdeveloper.com/forum/showthread.php?136969-Help-Customizing-Script-to-Subtract-Business-Days-from-Current-Date

function businessDays(n,D){ // counts business days for a different problem
D = D || new Date();
var num = Math.abs(n);
var tem, count = 0;
var dir = (n&lt;0)? -1: 1;
while (count &lt; num) {
D = new Date(D.setDate(D.getDate()+dir));
if ( D.isFixedHoliday() || D.isVariableHoliday() ) { continue; } // bypass count if holiday found
tem = D.getDay(); if(tem != 0 &amp;&amp; tem != 6) ++count;
}
return D;
}

Date.prototype.isFixedHoliday=function(){
var A=[this.getMonth()+1,this.getDate()]
var hol = { // fixed dates of year
'New Year':[1,1],
'Ground Hog Day':[2,2],
'Valentine':[2,14],
'Independence Day':[7,4],
'Christmas':[12,25]
}
var tem;
for(var p in hol) {
tem= hol[p]; if(A[0]==tem[0] &amp;&amp; A[1]==tem[1]) return p; // not false value if match found
}
return false;
}

Date.prototype.variableDate = function(){
// get month and date - no leading zeroes)
var A=[this.getMonth()+1,this.getDate()];

// weekday from beginning of the month (month/number_of_week/day_of_week)
var n_wday = this.getDay(),
n_wnum = Math.floor((A[1] - 1) / 7) + 1;
var v_date = A[0] + ',' + n_wnum + ',' + n_wday;

return v_date;
}

Date.prototype.isVariableHoliday = function(){
var now = this.variableDate(); // alert(today);

var hol = [ ]; // variable dates of year

/* variable dates of the year */ // Check format = 'month (1-12),week in month (1-5), day of week (0=Sun, 6=Sat.)
// hol['Current Date'] = '8,2,5'; // test entry for today for testing purposes only (change as needed)
hol['MLK BDay'] = '1,3,1'; // Birthday of Martin Luther King, third Monday in January
hol['GW BDay'] = '2,3,1'; // Washington's Birthday, third Monday in February
hol['Armed Forces Day'] = '5,3,6'; // Armed Forces Day, third Saturday in May
hol['Labor Day'] = '9,1,1'; // Labor Day, first Monday in September
hol['Columbus Day'] = '10,2,1'; // Columbus Day, second Monday in October
hol['Thanksgiving'] = '11,4,4'; // Thanksgiving Day, fourth Thursday in November
hol['Black Friday'] = '11,4,5'; // Thanksgiving Day +1, fourth Friday in November

var tem;
for(var p in hol){
tem= hol[p]; if (now == hol[p]) { return p; } // return key if match found (not false value)
}
return false;
}

window.onload = function() {
// sample usage:
var today = new Date();
var debug = document.getElementById('debugDIV');
debug.innerHTML = '&lt;h1&gt; Business Day &amp;amp; Holiday Counter &lt;/h1&gt;';

var Dlong = today;
var Dshort = today.toLocaleDateString();

var D1long=businessDays(-3); //string for 3 days before now (today)
var D1short=businessDays(-3).toLocaleDateString(); //string for 3 days before now (today)
var D2long=businessDays(8); //object for 8 business days after now (today)
var D2short=businessDays(8).toLocaleDateString(); //object for 8 business days after now (today)

debug.innerHTML += 'Today: '+Dshort+' is also: '+Dlong; // display for now (today)
debug.innerHTML += '&lt;p&gt;Business days:';
debug.innerHTML += '-3 business days: '+D1short+' is also: '+D1long;
debug.innerHTML += '&lt;br&gt;+8 business days: '+D2short+' is also: '+D2long;
debug.innerHTML += '&lt;/p&gt;';
debug.innerHTML += '&lt;p&gt;Today test: '+today.variableDate()+' (month,week,day)'; // current day as a string variable
debug.innerHTML += 'Fixed Holiday? : '+today.isFixedHoliday(); // test for today being a fixed holiday
debug.innerHTML += '&lt;br&gt;Variable Holiday? : '+today.isVariableHoliday(); // test for today being a variable holiday
debug.innerHTML += '&lt;/p&gt;';

var str = '&lt;p&gt;&lt;b&gt; 30, 45, 60 &amp;amp; 90 BUSINESS days +/- from today&lt;/b&gt;';
str += '&lt;br&gt;-90: '+businessDays(-90);
str += '&lt;br&gt;-60: '+businessDays(-60);
str += '&lt;br&gt;-45: '+businessDays(-45);
str += '&lt;br&gt;-30: '+businessDays(-30);
str += '&lt;br&gt;-14: '+businessDays(-14);
str += '&lt;br&gt;-7: '+businessDays(-7);
str += '&lt;br&gt;&lt;b&gt;'+today+'&lt;/b&gt;';
str += '&lt;br&gt;+7: '+businessDays(7);
str += '&lt;br&gt;+14: '+businessDays(14);
str += '&lt;br&gt;+30: '+businessDays(30);
str += '&lt;br&gt;+45: '+businessDays(45);
str += '&lt;br&gt;+60: '+businessDays(60);
str += '&lt;br&gt;+90: '+businessDays(90);

debug.innerHTML += str+'&lt;/p&gt;';
}

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@007JulienAug 09.2013 — Unless I'm mistaken, I saw a variable [I]EnumDaysM30 = -2592000[/I] witch seems to use 30 days of 86400 seconds ? I have not extended the investigation to further use of this kind of variables, but just wanted to warn you !

Here is another calendar of school Holydays in France (this changes with academic areas)...

Connected teachers have the ability (with Ajax calls in a php version) to update new years (see 2015 ...) by clicking on months or days while holding down the Ctrl key.

With holidays it could be an other way to display your four sections...

Good luck !
Copy linkTweet thisAlerts:
@nbkcu33Aug 13.2013 — JMRKER I like your solution for the Business day and holiday. ? It saves me from having to go in and update the dates of the variable holidays each year.

In my original script I was calculating date using 86400 seconds per day.
[CODE] <script type="text/javascript">
var InputDate;
var SelectDate;
var numDays;
var getDate;
var newDate

var Edate30
var Edate45
var Edate60
var Edate90

EnumDays0 = 0
EnumDays30 = 2592000 //(30 days) 2629743 (1 month=30.44 Days)
EnumDays45 = 3888000 //(45 days)
EnumDays60 = 5184000 //(60 Days) 5259486 (60.87 Days)
EnumDays90 = 7776000 //(90 Days) 7819200 (90.5 Days)

function addDate30(dateObject, numDays30) {
dateObject.setDate(dateObject.getDate() + numDays30);
return dateObject.toLocaleDateString();
}

function addDate45(dateObject, numDays45) {
dateObject.setDate(dateObject.getDate() + numDays45);
return dateObject.toLocaleDateString();
}

function addDate60(dateObject, numDays60) {
dateObject.setDate(dateObject.getDate() + numDays60);
return dateObject.toLocaleDateString();
}

function addDate90(dateObject, numDays90) {
dateObject.setDate(dateObject.getDate() + numDays90);
return dateObject.toLocaleDateString();
}

var EdateM30
var EdateM45
var EdateM60
var EdateM90

EnumDaysM30 = -2592000
EnumDaysM45 = -3888000
EnumDaysM60 = -5184000
EnumDaysM90 = -7776000


function addDatem10(dateObject, numDaysm10) {
dateObject.setDate(dateObject.getDate() + numDaysm10);
return dateObject.toLocaleDateString();
}

function addDatem30(dateObject, numDaysm30) {
dateObject.setDate(dateObject.getDate() + numDaysm30);
return dateObject.toLocaleDateString();
}

function addDatem45(dateObject, numDaysm45) {
dateObject.setDate(dateObject.getDate() + numDaysm45);
return dateObject.toLocaleDateString();
}

function addDatem60(dateObject, numDaysm60) {
dateObject.setDate(dateObject.getDate() + numDaysm60);
return dateObject.toLocaleDateString();
}

function addDatem90(dateObject, numDaysm90) {
dateObject.setDate(dateObject.getDate() + numDaysm90);
return dateObject.toLocaleDateString();
}


oldDate = new Date();
oldDate1 = new Date();
oldDate2 = new Date();
oldDate3 = new Date();
oldDate4 = new Date();

numDays30 = 30;
numDays45 = 45;
numDays60 = 60;
numDays90 = 90;

newDate30 = addDate30(oldDate1, numDays30);
newDate45 = addDate45(oldDate2, numDays45);
newDate60 = addDate60(oldDate3, numDays60);
newDate90 = addDate90(oldDate4, numDays90);

function SelectedDate (InputDate, EnumDays) {

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays0);
Edate0 = new Date (SelectDate *1000);
var eDate0 = (Edate0.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays30);
Edate30 = new Date (SelectDate *1000);
var eDate30 = (Edate30.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays45);
Edate45 = new Date (SelectDate *1000);
var eDate45 = (Edate45.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays60);
Edate60 = new Date (SelectDate *1000);
var eDate60 = (Edate60.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays90);
Edate90 = new Date (SelectDate *1000);
var eDate90 = (Edate90.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM30);
EdateM30 = new Date (SelectDate *1000);
var eDateM30 = (EdateM30.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM45);
EdateM45 = new Date (SelectDate *1000);
var eDateM45 = (EdateM45.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM60);
EdateM60 = new Date (SelectDate *1000);
var eDateM60 = (EdateM60.toLocaleDateString());

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDaysM90);
EdateM90 = new Date (SelectDate *1000);
var eDateM90 = (EdateM90.toLocaleDateString());


alert(("The date you selected is " + eDate0) + ("nnFUTURE CALENDAR DATES from your selected date:n30 Days is "+ eDate30) + ("n45 Days is ")+ eDate45 + ("n60 Days is ")+ eDate60 + ("n90 Days is ")+ eDate90 +("nnPAST FUTURE CALENDAR DATES from your selected date:n30 Days is ")+ eDateM30 + ("n45 Days is ")+ eDateM45 + ("n60 Days is ")+ eDateM60 + ("n90 Days is ")+ eDateM90);
}

oldDateM1 = new Date();
oldDateM2 = new Date();
oldDateM3 = new Date();
oldDateM4 = new Date();

numDaysM30 = -(30);
numDaysM45 = -(45);
numDaysM60 = -(60);
numDaysM90 = -(90);

newDateM30 = addDatem30(oldDateM1, numDaysM30);
newDateM45 = addDatem45(oldDateM2, numDaysM45);
newDateM60 = addDatem60(oldDateM3, numDaysM60);
newDateM90 = addDatem90(oldDateM5, numDaysM90);
</script>
[/CODE]

and displaying the dates using
[CODE] <span class="style3"><strong><em>Future CALENDAR Dates</em></strong></span><br>
<script type="text/javascript">
document.write("30 days = " + newDate30 + "");//using computer date
document.write("<br>45 days = " + newDate45 + "");
document.write("<br>60 days = " + newDate60 + "");
document.write("<br>68 days = " + newDate68 + "");
document.write("<br>90 days = " + newDate90 + "");
document.write("<br>118 days = " + newDate118 + "");
</script>


<br><br><span class="style3"><strong><em>Past CALENDAR Dates</em></strong></span>
<script type="text/javascript">
document.write("<br>30 days = " + newDateM30 + "");//using computer date
document.write("<br>45 days = " + newDateM45 + "");
document.write("<br>60 days = " + newDateM60 + "");
document.write("<br>68 days = " + newDateM68 + "");
document.write("<br>90 days = " + newDateM90 + "");
document.write("<br>118 days = " + newDateM118 + "");
</SCRIPT>
[/CODE]

and an "alert"; which did not always give me a correct date.

I am using "datetimepicker_ccs/js" from TengYong Ng and
[CODE]
<FORM NAME="myform">
<legend class="style3"><span class="style2"><strong><em>Calculate from Your Own Date</em></strong></span></legend>
<input type="Text" NAME="InputDate" class="style1" onchange="SelectedDate(this.form)" value="Select a Date">
<img src=\cal.gif" onclick="javascript:NewCssCal('InputDate','mmddyyyy','arrow')" style="cursor:hand"><br>
<input type="reset" value="Reset Calendar">

</form>
[/CODE]

to allow the uses to select any date. Now the problem I am having is calculating the Business Dates from the selected date.
Copy linkTweet thisAlerts:
@JMRKERAug 14.2013 — Once again I will say: You cannot use document.write statements to change the webpage AFTER it has been rendered.

It will only reload the page with the original contents. Not what you want or expect, I assume.

Also, why are you using 86400 seconds per day when the solution I provided does not use that method at all.

Finally, what is the format of the date returned by your datetimepicker_css? I don't use that particular script.

Rather than mess-up your current webpage design, show a BRIEF example of you datepicker and the code I posted.

Then we can debug your problem and put the corrections into your original page.
Copy linkTweet thisAlerts:
@nbkcu33Aug 19.2013 — Once again I will say: You cannot use document.write statements to change the webpage AFTER it has been rendered.

It will only reload the page with the original contents. Not what you want or expect, I assume.

Also, why are you using 86400 seconds per day when the solution I provided does not use that method at all.

Finally, what is the format of the date returned by your datetimepicker_css? I don't use that particular script.

Rather than mess-up your current webpage design, show a BRIEF example of you datepicker and the code I posted.

Then we can debug your problem and put the corrections into your original page.[/QUOTE]


I was using the "Document.write" to display the dates calculated from the computer's date, so it did not have to refresh when a date was selected.

I [I][B]was[/B][/I] using 86400 seconds/day in my original code. My new code is using the code you provided.

The datepicker_ccs.js is 1341 lines so if I included it on this post the post would not be brief.

The datepicker_ccs.js uses Epoch time to determine the selected date.

In order to allow a user to select a date and to display the selected date I am using the following code:
[CODE]
<script src="\datetimepicker_css.js"></script>
</head>
<body>
<script type="text/javascript">

var Edate0
var InputDate;
var SelectDate;
var numDays;
var getDate;
var newDate

EnumDays0 = 0

oldDate = new Date();
numDays0 = 0

function SelectedDate (InputDate, EnumDays) {

var SelectDate = ((Date.parse(myform.InputDate.value) / 1000) + EnumDays0);
Edate0 = new Date (SelectDate *1000);
var eDate0 = (Edate0.toLocaleDateString());

function addDate0(dateObject, numDays0) {
dateObject.setDate(dateObject.getDate() + numDays0);
return dateObject.toLocaleDateString();
}


alert(("The date you selected is " + eDate0));
}

</script>
<FORM NAME="myform">
<legend class="style3"><span class="style2"><strong><em>Calculate from Your Own Date</em></strong></span></legend>
<input type="Text" NAME="InputDate" class="style1" onchange="SelectedDate(this.form)" value="Select a Date">
<img src="\cal.gif" onclick="javascript:NewCssCal('InputDate','mmddyyyy','arrow')" style="cursor:hand"><br>
<input type="reset" value="Reset Calendar">
</form>
</body>
</html>
[/CODE]

I am using your code as follows:
[CODE]
<%@ Page Language="C#" %>
<!DOCTYPE HTML>
<html>
<head>
<META name="WebPartPageExpansion" content="full">
<title> Fixed & Variable Holidays </title>
<meta charset="utf-8">
</head>
<body>
<div id="debugDIV"></div>

<script type="text/javascript">

//Business Days from Today's Date

function businessDays(n,D){ // counts business days for a different problem
D = D || new Date();
var num = Math.abs(n);
var tem, count = 0;
var dir = (n<0)? -1: 1;
while (count < num) {
D = new Date(D.setDate(D.getDate()+dir));
if ( D.isFixedHoliday() || D.isVariableHoliday() ) { continue; } // bypass count if holiday found
tem = D.getDay(); if(tem != 0 && tem != 6) ++count;
}
return D;
}

Date.prototype.isFixedHoliday=function(){
var A=[this.getMonth()+1,this.getDate()]
var hol = { // fixed dates of year
'New Year':[1,1],
'Ground Hog Day':[2,2],
'Valentine':[2,14],
'Independence Day':[7,4],
'Christmas':[12,25]
}
var tem;
for(var p in hol) {
tem= hol[p]; if(A[0]==tem[0] && A[1]==tem[1]) return p; // not false value if match found
}
return false;
}

Date.prototype.variableDate = function(){
// get month and date - no leading zeroes)
var A=[this.getMonth()+1,this.getDate()];

// weekday from beginning of the month (month/number_of_week/day_of_week)
var n_wday = this.getDay(),
n_wnum = Math.floor((A[1] - 1) / 7) + 1;
var v_date = A[0] + ',' + n_wnum + ',' + n_wday;

return v_date;
}

Date.prototype.isVariableHoliday = function(){
var now = this.variableDate(); // alert(today);

var hol = [ ]; // variable dates of year

/* variable dates of the year */ // &#x10;Check format = 'month (1-12),week in month (1-5), day of week (0=Sun, 6=Sat.)
// hol['Current Date'] = '8,2,5'; // test entry for today for testing purposes only (change as needed)
hol['MLK BDay'] = '1,3,1'; // Birthday of Martin Luther King, third Monday in January
hol['GW BDay'] = '2,3,1'; // Washington's Birthday, third Monday in February
hol['Armed Forces Day'] = '5,3,6'; // Armed Forces Day, third Saturday in May
hol['Labor Day'] = '9,1,1'; // Labor Day, first Monday in September
hol['Columbus Day'] = '10,2,1'; // Columbus Day, second Monday in October
hol['Thanksgiving'] = '11,4,4'; // Thanksgiving Day, fourth Thursday in November
hol['Black Friday'] = '11,4,5'; // Thanksgiving Day +1, fourth Friday in November

var tem;
for(var p in hol){
tem= hol[p]; if (now == hol[p]) { return p; } // return key if match found (not false value)
}
return false;
}

window.onload = function() {
// sample usage:
var today = new Date();
var debug = document.getElementById('debugDIV');
debug.innerHTML = '<h2><i>Check Fraud Important Date Calculator</i></h2>';

var Dshort = today.toLocaleDateString();

var D1short=businessDays(2).toLocaleDateString(); //string for 3 days after now (today)
var D2short=businessDays(10).toLocaleDateString(); //object for 8 business days after now (today)
var D3short=businessDays(-10).toLocaleDateString(); //object for 10 business days before now (today)

//Calendar Days from Today's date

function calDays(n,C) {
C = C || new Date();
var num = Math.abs(n);
var tem, count = 0;
var dir = (n<0)? -1: 1;
while (count < num) {
C = new Date(C.setDate(C.getDate()+dir));
tem = C.getDay(); if(tem != -1 && tem != 7) ++count;
}
return C;
}

debug.innerHTML += '<i><h3>Today's Date:</h3></i> '+Dshort; // is also: '+Dlong; // display for now (today)
debug.innerHTML += '<i><h4>Business days from Today's Date<br> - Future Date</h4></i>';
debug.innerHTML += '2 business days: '+D1short; //+' is also: '+D1long;
debug.innerHTML += '<br>10 business days: '+D2short; //+' is also: '+D2long;
debug.innerHTML += '<p><h4><i><b>- Past Dates </b></i></h4>';
debug.innerHTML += '10 business days: '+D3short;
}

</script>
</body>
</html>
[/CODE]

I hope I included everything you are looking for.
Copy linkTweet thisAlerts:
@JMRKERAug 19.2013 — I...

The datepicker_ccs.js is 1341 lines so if I included it on this post the post would not be brief.

The datepicker_ccs.js uses Epoch time to determine the selected date.

In order to allow a user to select a date and to display the selected date I am using the following code:
[CODE]
<script src="\datetimepicker_css.js"></script>
...
[/CODE]

I hope I included everything you are looking for.[/QUOTE]


Since you cannot post because of the size, can you provide a link to the datetimepicker_css.js script?

If not, can you provide a live link to your program for testing?
Copy linkTweet thisAlerts:
@nbkcu33Aug 19.2013 — Since you cannot post because of the size, can you provide a link to the datetimepicker_css.js script?

If not, can you provide a live link to your program for testing?[/QUOTE]


I found the js script at http://www.rainforestnet.com/datetimepicker/datetimepicker.htm. On this site they have the code along with examples and demos.
Copy linkTweet thisAlerts:
@nbkcu33Aug 26.2013 — I have adapted the code you provided to only calculate date (not business days) for testing purposes. [CODE]
<html>
<head>
<META name="WebPartPageExpansion" content="full">
<title> Fixed & Variable Holidays </title>
<meta charset="utf-8"> <script src="\datetimepicker_css.js"></script>
<style type="text/css">
.style1 {
margin-top: 0px;
}
.style2 {
text-align: center;
}
.style3 {
color: #0d2bcc;
}
.style4 {
margin-bottom: 0px;
}
.style5 {
text-align: left;
}
.style6 {
color: #FFFFFF;
}
</style>
</head>

<body>
<script type="text/javascript">

var Edate
var InputDate;

numDays0 = 0

function SelectedDate (InputDate) {

var InputDate

var SelectDate = Date.parse(myform.InputDate.value);
Edate = new Date (SelectDate);
var eDate = (Edate.toLocaleDateString());

//Calendar Days from Selected date

function ScalDays(n,S) {
S = S || new Date(SelectedDate);
var num = Math.abs(n);
var tem, count = 0;
var dir = (n<0)? -1: 1;
while (count < num) {
S = new Date(S.setDate(S.getDate()+dir));
tem = S.getDay(); if(tem != -1 && tem != 7) ++count;
}
return S;
}

var D9short=ScalDays(30).toLocaleDateString(); //object for 30 calendar days after now (Selected)

alert(("The date you selected is " + eDate) + "nnFUTURE CALENDAR DATES from your selected date:n30 Days is "+ D9short);
}
</script>
<fieldset style="height: 70px; width: 316px;" class="style4">
<FORM NAME="myform" style="width: 308px">
<legend class="style3"><span class="style2"><strong><em>Calculate from Your Own Date</em></strong></span></legend>
<input type="Text" NAME="InputDate" class="style1" onchange="SelectedDate(this.form)" value="Select a Date">
<img src=/cal.gif" onclick="javascript:NewCssCal('InputDate','mmddyyyy','arrow')" style="cursor:hand"><br>
<input type="reset" value="Reset Calendar">
</form>
</fieldset>
</body>
</html> [/CODE]


I now receive an alert that reads "The date you selected is" eDate (the selected date) "Future Calendar Dates from your selected date: 30 Days is NaN". I am not sure why the D9short date is appearing as NaN since the date should NOT be a number.
×

Success!

Help @rwest81 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...