Results 1 to 3 of 3

Thread: [Resolved] JavaScript: Leap Year?

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [Resolved] JavaScript: Leap Year?

    How can I tell if a year is a leap year in JavaScript?
    Last edited by The Hobo; Apr 29th, 2003 at 04:44 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    Assuming year is an integer value:

    Code:
      if (year % 4 == 0 && (!(year % 100 == 0) || year % 400 == 0))
    {
      //Leap year
    }
    else
    {
      //No leap year
    }

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Thanks.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width