Ask Your Question
0

Convert to date string - record:errorTime()

asked 2018-09-26 09:36:41 -0600

KRT gravatar image

Error function - record:errorTime() The time the record was sent to error. Return type: Long.

If I use record:errorTime(), the return value something like '1537539772693'. How can I convert the long date to string format, something like 'dd-mm-yyyy hh:mm:ss'

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-09-26 10:24:04 -0600

iamontheinet gravatar image

updated 2018-09-26 10:32:45 -0600

Hi!

This should work ${time:extractStringFromDate(time:millisecondsToDateTime(record:errorTime()),'dd-MM-yyyy hh:mm:ss')}.

For more details on Time based functions, refer to the docs.

Cheers, Dash

edit flag offensive delete link more

Comments

Getting error - CTRCMN_0100 - Error evaluating expression ${time:extractStringFromDate(record:errorTime(),'dd-MM-yyyy hh:mm:ss')}: javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.lang.Long" to type "java.util.Date"

KRT gravatar imageKRT ( 2018-09-26 10:30:01 -0600 )edit

I've updated my answer to first convert time in milliseconds to Date.

iamontheinet gravatar imageiamontheinet ( 2018-09-26 10:33:51 -0600 )edit

Hello all, I want to know where you use this kind of function? I tried to create a runtime parameter in my pipeline with something similar, but I have an error regarding the not existence of time function/mapping. Do you have any idea?

LuisFe Melo gravatar imageLuisFe Melo ( 2018-11-05 03:28:27 -0600 )edit

Please ask a new question and add all the details there.

iamontheinet gravatar imageiamontheinet ( 2018-11-06 16:24:13 -0600 )edit
LuisFe Melo gravatar imageLuisFe Melo ( 2018-11-07 03:05:27 -0600 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-09-26 09:36:41 -0600

Seen: 46 times

Last updated: Sep 26