How to print current time in EPL

Hello all,
how can I print the current time as a string?
using “TimeFormat.format(currentTime, “yyyy-MM-dd’T’HH:mm:ss.SSS’Z’”),” does not work.
Thank you.

Please refer to these documentation links to see if they resolve your issue, otherwise please can you provide the full line for reference.
Apama (
currentTime (


1 Like

Could you elaborate a bit more on what does happen and what you are looking to achieve? Is Z intended to be a literal letter?

I’ve recently been doing just this with a slighht variance with the seconds.

constant string ISO_FORMAT := "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";

string now := TimeFormat.format(currentTime, ISO_FORMAT);

This works:

using com.apama.correlator.timeformat.TimeFormat;

monitor MySampleMonitor {

/** Initialize the application */

action onload() {

log "The current time is: " + TimeFormat.format(currentTime, “yyyy-MM-dd’T’HH:mm:ss.SSS’Z’”) at INFO;



(Be careful copying/pasting that you get basic ascii quote characters and note any kind of smart-quotes.)

1 Like

And another solution: if you are in Cumulocity and want to get the format Cumulocity is using, there is Util.formatTime():

1 Like