Date.new('2007-09-01') not legal?

G

Greg Willits

Is that form of creating a new date object really not legal? If so, that
seems mighty odd.

-- gw
 
B

Ball, Donald A Jr (Library)

-----Original Message-----
From: (e-mail address removed)=20
[mailto:[email protected]] On Behalf Of Greg Willits
Sent: Wednesday, November 14, 2007 12:52 PM
To: ruby-talk ML
Subject: Date.new('2007-09-01') not legal?
=20
Is that form of creating a new date object really not legal?=20
If so, that seems mighty odd.

Try Date.parse('2007-09-01').

- doanld
 
G

Greg Willits

Is that form of creating a new date object really not legal?
Try Date.parse('2007-09-01').

Whew :)

Weird, but I don't see this documented anywhere in "Programming Ruby"

Thanks!

-- gw
 
E

Eric Hodel

Is that form of creating a new date object really not legal? If so,
that
seems mighty odd.

You want Date.parse.

$ ri Date.new
-------------------------------------------------------------- Date::new
Date::new(ajd=0, of=0, sg=ITALY)
------------------------------------------------------------------------
NOTE this is the documentation for the method new!(). If you are
reading this as the documentation for new(), that is because rdoc
doesn't fully support the aliasing of the initialize() method.
new() is in fact an alias for #civil(): read the documentation for
that method instead.

Create a new Date object.

ajd is the Astronomical Julian Day Number. of is the offset from
UTC as a fraction of a day. Both default to 0.

sg specifies the Day of Calendar Reform to use for this Date
object.

Using one of the factory methods such as Date::civil is generally
easier and safer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,270
Messages
2,571,352
Members
48,034
Latest member
BettinaArn

Latest Threads

Top