Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Epoch to DateTime JSON Variable Conversion

Hello Apigee Community,

What's the best way to convert a JSON variable from EPOCH to DateTime?

Can this be done via JavaScript Policy?

If so, do you have an example?

Thank you!

Solved Solved
0 4 6,230
1 ACCEPTED SOLUTION

This ended up working for me:

var dateTime = JSON.parse(context.getVariable('PaymentDateTime'));
var PaymentDateTime = new Date(dateTime * 1000).toISOString("yyyy'-'MM'-'dd HH':'mm':'ss'Z'");
context.setVariable("PaymentDateTime", PaymentDateTime);

View solution in original post

4 REPLIES 4