Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting Stripe's Timestamps

What I thought would be some simple timestamp formatting is giving me a bit of grief. Probably just a silly mistake though!

In my Rails 4 app, I'm retrieving data from Stripe's API. I'm having an issue with the timestamps that they return.

If I just output the timestamp like this:

@subscription.trial_end

then I have no problem. But if I want to format the timestamp like this:

@subscription.trial_end.strftime("%d/%m/%Y")

then I'm getting this error:

undefined method `strftime' for 1384109487:Fixnum

Can I use strftime on this value?

like image 518
tommyd456 Avatar asked Oct 12 '13 07:10

tommyd456


1 Answers

Sorry - got it sorted:

Time.at(@subscription.trial_end).strftime("%d/%m/%Y")
like image 80
tommyd456 Avatar answered Sep 19 '22 20:09

tommyd456