views:

321

answers:

3

Working with dates in ruby and rails on windows, having problems with pre-epoch dates (before 1970) throwing out of range exceptions. Tried using both Time and DateTime objects but continuing to have the same problems.

A: 

If you only need dates (no times), the Date class in ruby should handle dates before 1970. But it has only a resolution of days. I don't know if there are solutions, if you also need times before 1970 (source)

Mo
A: 

You can also check out the section on dates on ruby-doc.org. I'm still learning Ruby but it sounds like you could use either the Civil or Commerical Date to go back before 1970.

Scott Gottreu
A: 

Ended up using the Date class, problem then became making that work with the rails select helper - which didn't happen, just generated the html myself.

John Duff