Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Javascript Date Object

Reply
Thread Tools

Javascript Date Object

 
 
C
Guest
Posts: n/a
 
      09-05-2003
Hi,

I take ina series of date inputs from the user.

I use below JavaScript to parse String into a Date Object
and then I get the Day part and compare the day part.

The date entered for elFPD is 1/1/2003
The date entered for elBalloon is 12/1/2003

The day I get back for elFPD is 3
and teh day I get back for elBalloon is 1.

Anyone know why this is?

MY date settings are English(US)

function CheckDates(){

var elFPD = new Date
(document.frmDefease.txFPD.value);
var elDef = new Date
(document.frmDefease.txDefClose.value);
var elBalloon = new Date
(document.frmDefease.txBalloon.value);


if (elFPD > elBalloon)
{
alert('First Payment Date must not
exceeed Balloon Date');
document.frmDefease.submit=false;
}
else
{

if (elFPD > elDef)
{
alert('First Payment Date
must not exceeed Defeasance Date');

document.frmDefease.submit=false;

}
};

//check Day of FPD against Day of Balloon Date
var FPDDay;
var BalloonDay;
FPDDay = elFPD.getDay();
BalloonDay = elBalloon.getDay();


if(FPDDay != BalloonDay)
{
alert('First Payment Date
day must be the same as Balloon Date day');

}

}
 
Reply With Quote
 
 
 
 
Dan Brussee
Guest
Posts: n/a
 
      09-05-2003
On Fri, 5 Sep 2003 04:26:40 -0700, "C" <(E-Mail Removed)> wrote:

>Hi,
>
>I take ina series of date inputs from the user.
>
>I use below JavaScript to parse String into a Date Object
>and then I get the Day part and compare the day part.
>
>The date entered for elFPD is 1/1/2003
>The date entered for elBalloon is 12/1/2003
>
>The day I get back for elFPD is 3
>and teh day I get back for elBalloon is 1.
>


blah blah blah

> //check Day of FPD against Day of Balloon Date
> var FPDDay;
> var BalloonDay;
> FPDDay = elFPD.getDay();
> BalloonDay = elBalloon.getDay();
>
>
> if(FPDDay != BalloonDay)
> {
> alert('First Payment Date
>day must be the same as Balloon Date day');
>
> }
>
>}


Get the ol' Javascript book out I think. The getDay() method of a date
object returns the day of week. 1/1/2003 is a Wednesday (Day number
3), while 12/1/2003 is a Monday (Day number 1). I think what you are
looking for is the getDate() method, which returns the day of month.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP General 11 11-08-2003 11:24 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments