0

I use invoiced API

https://invoiced.com/docs/guides/subscription-billing

and I got records like

"renewed_last": 1493732122,
"renews_next": 1496410522,
"start_date": 1493732122,

What those magic numbers mean? I thought this is milliseconds from 1970, but it's not true. They can render data properly on their site, but I can't get date for me app. How to get date from those magic numbers?

avalon
  • 2,231
  • 3
  • 24
  • 49
  • Why you can't use api library https://github.com/Invoiced/invoiced-java In the examples timestams converted to java.sql.TimeStamp class – Maxim Tulupov May 04 '17 at 12:42
  • I use this library. The issue is some fields like createdAt are timestamps, but those I need just integer numbers, how to convert them? – avalon May 04 '17 at 13:16

1 Answers1

1

According to the api docs all dates are in unixtimestamp https://en.wikipedia.org/wiki/Unix_time

It is timestamp in seconds from Jan 1 1970, Java calculates time in millisecond

So the solution is

new Date(unixTimestamp * 1000L);
Maxim Tulupov
  • 1,621
  • 13
  • 8