Saturday 15 January 2011

Invalid date getting displayed in rails -



Invalid date getting displayed in rails -

i know mutual error not resolve after trying answers.

through rest api sending parameters inculdes dates. recieving info in method want when trying parse date throws error of invalid date.

here parameters recieving

{"uid"=>"1", "user"=>"abc.a@abc.com", "from"=>"mon nov 3 24:59:12 cet 2014", "to"=>"tue nov 11 24:59:12 cet 2014"}

and date format

mon nov 3 24:59:12 cet 2014

but throwing error on parsing on line below

fr = datetime.parse(params[:from]) unless params[:from].empty?

i tried strptime did not work.

imp points need hr later processing. thanks

what doing wrong parsing datetime while date , should parsed 1 of next ways:

1.

>> fr = params[:from].to_date unless params[:from].empty? => mon, 03 nov 2014

2.

>> fr = date.parse(params[:from]) unless params[:from].empty? => mon, 03 nov 2014

ruby-on-rails date datetime

No comments:

Post a Comment