CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 Help - javascript day of week problem

Print topic Send  topic

Author Message
Frank Rocco
Posted: 10/20/2003, 12:01 PM

Hello, the following code does not work.
xdate is not an object.

var xdate = Date.parse(document.forms["REQUESTS"].ADM_REQ_DATE.value);
var theDay = xdate.getDay();
alert(theDay);

What am I doing wrong?

Thanks

Frank

DonB
Posted: 10/21/2003, 6:06 AM

Three questions, Frank:

1. is ADM_REQ_DATE.value a *valid* date representation?
2. does alert(document.forms["REQUESTS"].ADM_REQ_DATE.value) display the
correct date?
3. does substituting var xdate = Date.parse(<put a literal date value
here>) make the "not an object" error go away?

--
DonB

http://www.gotodon.com/ccbth


"Frank Rocco" <farocco@hotmail.com> wrote in message
news:bn1be4$ddm$1@news.codecharge.com...
> Hello, the following code does not work.
> xdate is not an object.
>
> var xdate = Date.parse(document.forms["REQUESTS"].ADM_REQ_DATE.value);
> var theDay = xdate.getDay();
> alert(theDay);
>
> What am I doing wrong?
>
> Thanks
>
> Frank
>
>

Frank Rocco
Posted: 10/21/2003, 6:10 AM

Hi DonB,

Yes to #1
Yes to #2
I got around this by substring of the control into it's date parts. eg m,d,y
and using:

var theDate = Date(y,m,d);

This works, but I would of liked to have used my original code.

Regards,

Frank
"DonB" <~ccbth~@gotodon.com> wrote in message
news:bn3b0g$7qj$1@news.codecharge.com...
> Three questions, Frank:
>
> 1. is ADM_REQ_DATE.value a *valid* date representation?
> 2. does alert(document.forms["REQUESTS"].ADM_REQ_DATE.value) display the
> correct date?
> 3. does substituting var xdate = Date.parse(<put a literal date value
> here>) make the "not an object" error go away?
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
> "Frank Rocco" <farocco@hotmail.com> wrote in message
>news:bn1be4$ddm$1@news.codecharge.com...
> > Hello, the following code does not work.
> > xdate is not an object.
> >
> > var xdate = Date.parse(document.forms["REQUESTS"].ADM_REQ_DATE.value);
> > var theDay = xdate.getDay();
> > alert(theDay);
> >
> > What am I doing wrong?
> >
> > Thanks
> >
> > Frank
> >
> >
>
>

DonB
Posted: 10/21/2003, 6:37 AM

Then the structure of your date was probably the culprit. I'd guess it was
mm/dd/yyyy or dd/mm/yyyy (maybe even a 2-digit year?). Perhaps if you tried
either of these ways: "21 Oct, 2003" or "Oct 21, 2003" it would work?

It would be useful info to know what effect this has, even though you've
resolved it another way. Please try it and post the results.

--
DonB

http://www.gotodon.com/ccbth


"Frank Rocco" <farocco@hotmail.com> wrote in message
news:bn3b7u$8da$1@news.codecharge.com...
> Hi DonB,
>
> Yes to #1
> Yes to #2
> I got around this by substring of the control into it's date parts. eg
m,d,y
> and using:
>
> var theDate = Date(y,m,d);
>
> This works, but I would of liked to have used my original code.
>
> Regards,
>
> Frank
> "DonB" <~ccbth~@gotodon.com> wrote in message
>news:bn3b0g$7qj$1@news.codecharge.com...
> > Three questions, Frank:
> >
> > 1. is ADM_REQ_DATE.value a *valid* date representation?
> > 2. does alert(document.forms["REQUESTS"].ADM_REQ_DATE.value) display
the
> > correct date?
> > 3. does substituting var xdate = Date.parse(<put a literal date value
> > here>) make the "not an object" error go away?
> >
> > --
> > DonB
> >
> > http://www.gotodon.com/ccbth
> >
> >
> > "Frank Rocco" <farocco@hotmail.com> wrote in message
> >news:bn1be4$ddm$1@news.codecharge.com...
> > > Hello, the following code does not work.
> > > xdate is not an object.
> > >
> > > var xdate =
Date.parse(document.forms["REQUESTS"].ADM_REQ_DATE.value);
> > > var theDay = xdate.getDay();
> > > alert(theDay);
> > >
> > > What am I doing wrong?
> > >
> > > Thanks
> > >
> > > Frank
> > >
> > >
> >
> >
>
>

Frank Rocco
Posted: 10/21/2003, 7:58 AM

Hi DonB,

I tried:

var theDate = Date.parse("Oct 21, 2003");
var theDate = Date.parse("21 Oct, 2003");

and get the same error.

Regards,

Frank

"DonB" <~ccbth~@gotodon.com> wrote in message
news:bn3cqv$bav$1@news.codecharge.com...
> Then the structure of your date was probably the culprit. I'd guess it
was
> mm/dd/yyyy or dd/mm/yyyy (maybe even a 2-digit year?). Perhaps if you
tried
> either of these ways: "21 Oct, 2003" or "Oct 21, 2003" it would work?
>
> It would be useful info to know what effect this has, even though you've
> resolved it another way. Please try it and post the results.
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
> "Frank Rocco" <farocco@hotmail.com> wrote in message
>news:bn3b7u$8da$1@news.codecharge.com...
> > Hi DonB,
> >
> > Yes to #1
> > Yes to #2
> > I got around this by substring of the control into it's date parts. eg
> m,d,y
> > and using:
> >
> > var theDate = Date(y,m,d);
> >
> > This works, but I would of liked to have used my original code.
> >
> > Regards,
> >
> > Frank
> > "DonB" <~ccbth~@gotodon.com> wrote in message
> >news:bn3b0g$7qj$1@news.codecharge.com...
> > > Three questions, Frank:
> > >
> > > 1. is ADM_REQ_DATE.value a *valid* date representation?
> > > 2. does alert(document.forms["REQUESTS"].ADM_REQ_DATE.value) display
> the
> > > correct date?
> > > 3. does substituting var xdate = Date.parse(<put a literal date value
> > > here>) make the "not an object" error go away?
> > >
> > > --
> > > DonB
> > >
> > > http://www.gotodon.com/ccbth
> > >
> > >
> > > "Frank Rocco" <farocco@hotmail.com> wrote in message
> > >news:bn1be4$ddm$1@news.codecharge.com...
> > > > Hello, the following code does not work.
> > > > xdate is not an object.
> > > >
> > > > var xdate =
> Date.parse(document.forms["REQUESTS"].ADM_REQ_DATE.value);
> > > > var theDay = xdate.getDay();
> > > > alert(theDay);
> > > >
> > > > What am I doing wrong?
> > > >
> > > > Thanks
> > > >
> > > > Frank
> > > >
> > > >
> > >
> > >
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.