# Parsing date from PayPal fails

**URL:** <https://www.ruby-forum.com/t/parsing-date-from-paypal-fails/103010>\
**Category:** Rails\
**Created:** [April 30, 2007, 6:52pm UTC](https://www.ruby-forum.com/t/parsing-date-from-paypal-fails/103010 "2007-04-30T18:52:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [April 30, 2007, 6:52pm UTC](https://www.ruby-forum.com/t/parsing-date-from-paypal-fails/103010/1 "2007-04-30T18:52:07Z")

</div>

I have a scenario where this code works on Ruby 1.8.6 on my local  
environment but my hosting provider uses Ruby 1.8.5, and it causes an  
exception.

The code in questions is:

dt = DateTime.parse(params[:payment\_date])

and the date looks like: 09:45:21 Apr 30, 2007 PDT

Has anyone else run into this? Is there a prescribed way around it?

Exception follows:

ArgumentError (3 elements of civil date are necessary):  
/usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash' /usr/lib/ruby/1.8/date.rb:1258:in`parse’  
/app/controllers/ipn\_controller.rb:12:in `paypal_ipn' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in`send’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/base.rb:1095:in `perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:632:in`call\_filter’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/filters.rb:619:in `perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/rescue.rb:83:in `perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in`send’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/base.rb:430:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:in`process\_without\_session\_management\_support’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/session\_management.rb:114:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:in`process’  
/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in  
`dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 78:in`process’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:  
76:in `synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 76:in`process’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in  
`process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in`each’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in  
`process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in  
`initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in`new’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in`initialize’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in  
`new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/  
configurator.rb:271:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in`each’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/  
configurator.rb:270:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:  
211:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 /usr/bin/mongrel_rails:18:in`load’  
/usr/bin/mongrel\_rails:18
