views:

45

answers:

1

How do I take a numeric month, day and year from three separate text inputs and parse a proper value for my DateTime field in the db?

A: 
date = Date.civil(params[:year].to_i, params[:month].to_i, params[:day].to_i)
Isaac Cambron
It should be params[:year], params[:month], etc. Also, you will have to use .to_i to convert to an integer if using a textfield.
jluebbert
@jluebbert fixed
Isaac Cambron