How to convert epoch time to datetime format ?
search cancel

How to convert epoch time to datetime format ?

book

Article ID: 281062

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Running into 500 error when converting the epoch time to human readable form.

Environment

CA API Gateway 10.1, 11.0

Cause

Error in the code usage

Resolution

This is a simple way to set context variables to avoid the convert datetime to fail due multi-values customer used on his code.

1. After the line#4 Perform JDBC Query , add the following :

line#5 , Run Assertions for each items of ${jdbcQuery.created} as ${count.current}

line#6 Set Context Variable name.results as string to empty

line#7 Set Context Variable name.results as string to : ${name.results)${count.current}

line# 8 Set Context Variable temp as date/time to : ${name.results)

line# 9  Return template to requestor , where are set :

Response type Content :    text/html; charset=UTF-8

Response body :   ${temp}<br>

 

example:

 

Note :  if using  the "Return Template Response to Requestor " inside the loop, the example can display the values after that but if trying to convert all strings like showed below will fail


*** Example can be customized to convert each item from name.results one by one to display them on date format.

 

Attachments

epoch3.xml get_app