cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Cody.Naumann
AppDynamics Team (Retired)

Question

I want to report the event time in an email template using the international standard time format. How can I do this?

 

Answer

Use the following Apache Velocity template to convert the time into the format you need.

 

If using html body:

#set( $String = '' )
$String.format('%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS%Tp ', 
$latestEvent.eventTime)

  

If using text body:

#set( $String = '' )## 
$String.format('%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS%Tp ', 
$latestEvent.eventTime)

 

Sample output:

2017-02-07T13:14:02PM

 

Let us say you do not need AM/PM at the end of the date, the format is:

#set( $String = '' )
$String.format('%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS ', 
$latestEvent.eventTime)

 

Sample output:

2017-02-07T13:23:06

  

Resources: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#dt

  

Currently it is not possible to convert from one timezone to another, for example from PST to UTC.

 

Comments
cebrail.inanç
Explorer

How to convert for slack?

 

Version history
Last update:
‎12-21-2018 05:01 PM
Updated by:
Join Us On December 10
Learn how Splunk and AppDynamics are redefining observability


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here