Forum: Ruby on Rails Error with datetime_select w/ Year <1970 on MS Windows

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
i am zigx (Guest)
on 2007-08-01 04:27
(Received via mailing list)
I am seeing something very strange that does not appear to happen on
Can anyone confirm if this is a valid issue/bug?

I have created a datetime_select with the following code:
 <%= datetime_select(:album, :release_date, :start_year => 1960) %>

When i select any year 1970 and above the submit form works fine and i
debug(:params) no prob... but if i submit 1969 and older, I get the

ActiveRecord::MultiparameterAssignmentErrors in PublicController#create

1 error(s) on assignment of multiparameter attributes

#{RAILS_ROOT}/app/controllers/public_controller.rb:39:in `new'
#{RAILS_ROOT}/app/controllers/public_controller.rb:39:in `create'


Parameters: {"commit"=>"Create", "album"=>{"artist"=>"Jimi Hendrix",
"title"=>"Electric Lady Land", "release_date(1i)"=>"1969",
"release_date(2i)"=>"12", "release_date(3i)"=>"31", "genre"=>"Rock",
"release_date(4i)"=>"00", "release_date(5i)"=>"00"}}

Here is my version information:

About your application's environment
Ruby version                 1.8.6 (i386-mswin32)
RubyGems version             0.9.2
Rails version                1.2.3
Active Record version        1.15.3
Action Pack version          1.13.3
Action Web Service version   1.2.3
Action Mailer version        1.3.3
Active Support version       1.4.2
Application root             C:/railz/music_library
Environment                  development
Database adapter             mysql
Database schema version      0

Controller Code:

    def new
        @album =
        @album.title = 'Electric Lady Land'

View Code:

        <%= start_form_tag(:action => 'create') %>

            Title: <%= text_field(:album, :title) %><br />
            Artist: <%= text_field(:album, :artist) %><br />
            Genre: <%= text_field(:album, :genre) %><br />
            Release Date: <%= datetime_select(:album, :release_date,
:start_year => 1960) %><br />
            <br />
            <%= submit_tag("Create") %>

        <%= end_form_tag %>

Thank you all for your time, and my apologies if this is ridiculously
on 2007-08-01 23:42
(Received via mailing list)
If anyone knows a starting point for investigating this iw ould be
happy to follow up on my own, but i'm not sure where to start.  thank
Rob B. (Guest)
on 2007-08-02 02:52
(Received via mailing list)
On Aug 1, 2007, at 3:41 PM, removed_email_address@domain.invalid wrote:
>>  <%= datetime_select(:album, :release_date, :start_year => 1960) %>
>> When i select any year 1970 and above the submit form works fine
>> and i can
>> debug(:params) no prob... but if i submit 1969 and older, I get the
>> following:

Time only works for dates that are not prior to 1970-01-01 00:00:00
UTC when stored as a number of seconds since that time (often
referred to as the epoch).

Use a Date rather than a Time and you should be OK.


Rob B.
Kevin S. (Guest)
on 2007-08-02 03:12
(Received via mailing list)
It appears that you are working through my training tutorial on so I should jump in to help... :-)

Some platforms don't handle dates outside the 1970-2038 range well.
Rails' has to convert HTML form parameters into something that your
database can store.  The SQL adapter in Rails uses the Time class to
do that (because it's faster) but can be told to use DateTime instead.
On most systems, it's either not a problem or has been sorted out, but
there are a few set ups that still cause people grief. (such as
Microsoft / MS SQL)

There are official patches in the works such as:
and also do-it-yourself work arounds (a Google search for
'ActiveRecord DateTime 1970' should find them).  Searches in this
forum for '1970' may also yield useful tips.

My suggestion would be to input more recent dates while you continue
the tutorial. It's not important for you to solve this problem in
order to learn the essentials of Rails.  When you actually need dates
before 1970 for an application, you can try and see if it's been
solved "officially", switch platforms then, or investigate the DIY
solutions out there.

Kevin S.
This topic is locked and can not be replied to.