Time (leap year?)

(Michael Kelly) #1

Try:

now = DateTime.now
flag = Date.leap?( now.year )

···

--
Michael Kelly
Sr. Software Engineer
Eleven Wireless Inc. - The Possibilities are Wireless

-----Original Message-----
From: csjasnoch@wisc.edu [mailto:csjasnoch@wisc.edu]
Sent: Wednesday, August 31, 2005 1:06 PM
To: ruby-talk ML
Subject: Time (leap year??)

Is there a simple way to see if a year is a leap year (rather than
writting an algorithm I wanted to check if it is already implimented
first)

It would be kewl if there was just a check on a Time var

Like,

now = Time.new
flag = now.leapyear?

(csjasnoch@wisc.edu) #2

Wow that was fast:)
Thanx

(csjasnoch@wisc.edu) #3

Where could I find descriptions of the DateTime class?

I only really know about the Time class....

Does it have all of the same members and methods?

(Levin Alexander) #4

<http://www.ruby-doc.org/core/classes/Date.html>

The sidebar from ruby-doc.org are really helpful to quickly look up
class definitions: <http://www.ruby-doc.org/docbar/>

-Levin

···

csjasnoch@wisc.edu <csjasnoch@wisc.edu> wrote:

Where could I find descriptions of the DateTime class?