Forum Discussion
netwire
10 years agoFrequent Visitor
Converting Unix timestamp from Stripe API to Date/Time
Hi, Is there a way that I can convert the `created` attribute of a Stripe `charge` object to Date/Time? It's currently in text format as a Unix timestamp, i.e.: 1463948811, see example here https://...
- 10 years ago
Well, if it is a Unix timestamp, then it is the number of seconds from 1/1/1970 (UTC). So something like this calculated column should suffice:
UTCTime = VAR UnixDays = [UnixTime]/(60*60*24) RETURN (DATEVALUE("1/1/1970")+UnixDays)Basically, convert the number of seconds to the number of days and then add it to the date value of 1/1/1970. Essentially, the same thing you would do in Excel.
IvanBond
10 years agoAdvocate II
Hi,
Just an idea - try a function
https://github.com/IvanBond/pquery/blob/master/Date.EpochToDate.m
Best regards,
Ivan