Sylar Sylar - 9 months ago 95
Ruby Question

Stripe Charge Date Format

Again, I am new to stripe. I am using Rails and no JS for this section and I want to display the time a charge was made to the customer in my app. In the charge JSON, I see this:

"created": 1461761985,

So in my loop, (shortened):

<%= c.created.strftime() %>

undefined method `strftime' for 1461761985:Fixnum

I thought I could use strftime but getting few errors. Is there a way of converting this time format to
, in Rails 4?


That is a unix timestamp if I'm not wrong. Try these out:

DateTime.strptime(c.created.to_s, '%s')
# or