SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Initialising Date Variables?

    Hi,

    Why does the first line work but not the second line?

    var dtApr12007 = new Date("Apr 1, 2007");
    var dtApr12007 = new Date(2007,3,1);

    Thanks,

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I do this:

    var dtApr12007 = new Date(2007,3,1);
    alert(dtApr12007);

    in IE6 it works.

    What's the problem?

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    Hi Jim,

    Thanks for the response. I see we are not that far apart.

    It's working now but I'm sure it wasn't last night and I could see the variable as having no value when I was in debug mode with Mozilla.

    Maybe something was temporarily out of whack.

    Thanks,


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •