# 65.years.ago on Windows XP

**URL:** <https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713>\
**Category:** Rails\
**Created:** [January 11, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713 "2008-01-11T12:26:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbjl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rbjl](https://www.ruby-forum.com/u/rbjl)\
**Post date:** [January 11, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713/1 "2008-01-11T12:26:21Z")

</div>

Hello,

I’ve some trouble with years.ago I want so use in calendar\_date\_select  
as  
described here:  
[http://code.google.com/p/calendardateselect/wiki/CalendarDateSelectParameters](http://code.google.com/p/calendardateselect/wiki/CalendarDateSelectParameters)  
I wrote:  
\<%= contact.calendar\_date\_select :birth\_date, {:size =\> 10,  
:label  
=\> ‘Birthday’,:year\_range =\> [65.years.ago, 0.years.from\_now]} %\>

But years.ago seems to be bound to the OS’es time-routines, that is  
quite  
annoying:

eg.  
Linux:  
ruby script/console  
Loading development environment.

> > 65.years.ago  
> > =\> Mon Jan 11 06:21:12 +0100 1943

Windows XP 32-Bit  
ruby script/console  
Loading development environment.

> > 65.years.ago  
> > ArgumentError: time must be positive  
> > from  
> > W:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active\_support/core\_ext/numeric/time.rb:56:in  
> > `-' from W:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/numeric/time.rb:56:in `ago’  
> > from (irb):1

Is there a way to work around this issue - MySQL has no trouble saving  
dates  
down to 1000 anno domini…

Thanks,  
Keep smiling  
yanosz

---

<div class="post-metadata">

**Author:** ![rbjl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rbjl](https://www.ruby-forum.com/u/rbjl)\
**Post date:** [January 11, 2008, 12:57pm UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713/2 "2008-01-11T12:57:26Z")

</div>

In windows XP, ruby 1.8.6, recently updated win32 gems, Rails 2.0.2  
Rails console:

> > 1.years.ago  
> > =\> Thu Jan 11 13:52:19 +0200 2007
> 
> > 65.years.ago  
> > =\> Mon, 11 Jan 1943 13:52:27 +0200
> 
> > Time.now  
> > =\> Fri Jan 11 13:52:57 +0200 2008

It works for me. The musta fixed it.  
Try also

> gem outdated  
> to get a list of gems that aren’t the most recent. Could be rails,  
> could be the win32 gems, I guess.

F

---

<div class="post-metadata">

**Author:** ![rbjl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rbjl](https://www.ruby-forum.com/u/rbjl)\
**Post date:** [January 11, 2008, 3:59pm UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713/3 "2008-01-11T15:59:28Z")

</div>

Try this:

65.years.ago.to\_date

---

<div class="post-metadata">

**Author:** ![rbjl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rbjl](https://www.ruby-forum.com/u/rbjl)\
**Post date:** [September 29, 2008, 7:00am UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713/4 "2008-09-29T07:00:02Z")

</div>

\<%= contact.calendar\_date\_select :birth\_date, {:size =\> 10,  
:label =\> ‘Birthday’,:year\_range =\> Time.now.year-65…Time.now.year} %\>

---

<div class="post-metadata">

**Author:** ![rbjl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rbjl](https://www.ruby-forum.com/u/rbjl)\
**Post date:** [January 11, 2008, 1:29pm UTC](https://www.ruby-forum.com/t/65-years-ago-on-windows-xp/125713/5 "2008-01-11T13:29:40Z")

</div>

65.years.ago brings you well before the generally accepted Epoch of  
January  
1, 1970. Thus the unix timestamp turns negative, and the reason for the  
error. Not that it’s right to fail that way, however.

Also MySQL has its own way of storing dates that doesn’t use the  
timestamp,  
at least not obviously, so it doesn’t make sense to compare the two.

Jason
