Convert Epoch time to human readable time
search cancel

Convert Epoch time to human readable time

book

Article ID: 280935

calendar_today

Updated On: 03-21-2024

Products

CA API Gateway

Issue/Introduction

Is there a way to convert epoch time to human readable time using assertion in the Policy Manager?

For example, the epoch time is 1710776038 which is GMT and the human readable time is Monday, March 18, 2024 3:33:58 PM.

Environment

API Gateway 11.x

Resolution

1. Use a context variable to set the epoch time. Make sure to use a Date/Time Data Type.


2. In a new context variable or Return Template, set the desired human readable format.


3. Check/verify the time/date format.

Additional Information

Time/Date Syntax Reference: https://developer.hashicorp.com/terraform/language/functions/formatdate 

NOTE: You may need to test and toggle some of the settings from this site. For example, AM/PM was desired so 'AA' should have been used. 'AA' did not work but using 'aa' achieved the desired results.