On Nov 11, 2008, at 4:13 PM, jemminger wrote:>
> DateTime can
>
> On Nov 11, 4:04 pm, MartOn
<frode.mel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hello
>> Im planning to store really old dates, but it seems Rails are having
>> trouble with that.
>> Are there any date types I can use that support dates older than for
>> instance 1900?
>>
>> /MartOn
Since you said really old dates, why not use Date?
------------------------------------------------------------ Class: Date
Class representing a date.
See the documentation to the file date.rb for an overview.
Internally, the date is represented as an Astronomical Julian Day
Number, ajd. The Day of Calendar Reform, sg, is also stored, for
conversions to other date formats. (There is also an of field for
a time zone offset, but this is only for the use of the DateTime
subclass.)
A new Date object is created using one of the object creation
class methods named after the corresponding date format, and the
arguments appropriate to that date format; for instance,
Date::civil() (aliased to Date::new()) with year, month, and
day-of-month, or Date::ordinal() with year and day-of-year. All of
these object creation class methods also take the Day of Calendar
Reform as an optional argument.
Date objects are immutable once created.
Once a Date has been created, date values can be retrieved for the
different date formats supported using instance methods. For
instance, #mon() gives the Civil month, #cwday() gives the
Commercial day of the week, and #yday() gives the Ordinal day of
the year. Date values can be retrieved in any format, regardless
of what format was used to create the Date instance.
The Date class includes the Comparable module, allowing date
objects to be compared and sorted, ranges of dates to be created,
and so forth.
------------------------------------------------------------------------
You probably want to store them in some database, too, I imagine so
you want to be aware of how your database treats dates. Depending on
your range, MySQL''s DATE or DATETIME may be useful.
-Rob
Rob Biedenharn http://agileconsultingllc.com
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---