# To\_time "time out of range"

**URL:** <https://www.ruby-forum.com/t/to-time-time-out-of-range/103400>\
**Category:** Rails\
**Created:** [May 5, 2007, 7:53am UTC](https://www.ruby-forum.com/t/to-time-time-out-of-range/103400 "2007-05-05T07:53:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [May 5, 2007, 7:53am UTC](https://www.ruby-forum.com/t/to-time-time-out-of-range/103400/1 "2007-05-05T07:53:01Z")

</div>

Hello,

I’m experiencing some inconsistent results between code I run in the  
console and in my test/project code.

On the console this works…

> > Date.new(1899, 12, 25).to\_time  
> > =\> Fri Dec 13 14:45:52 CST 1901
> 
> > Date.new(2058, 12, 25).to\_time  
> > =\> Mon Jan 18 21:14:07 CST 2038

The values are changed to their min and max values.

If I do the same in my test or development code, I get an exception…  
ArgumentError: time out of range

Why would the conversion work on the console, but not in the other  
cases?

Thanks,  
Andrew
