Time.parse problem

Hi,
I am getting a date back from PayPal and it is being processed by
ActiveMerchant
The date comes back as:
“payment_date”=>“16:36:26 Aug 31, 2008 PDT”

This throws an argument out of range when ActiveMerchant does a
Time.parse on it.

I notice that

Time.parse(“Aug 31, 16:36:26 2008 PDT”)
works ok.

Is there any way that I work with the date in the order with time
first?

Cheers
George

Hi

Ideally, Time.parse on your payment_date string should work.
No idea why ActiveMerchant is failing.

Try parsing using strptime -

existing_format = “%H:%M:%S %b %d, %Y %Z”
d=Datetime.strptime(payment_date,existing_format)

  • neeti