Questions:
How to customize the lines of "start date" and "valid until" GMT format in a default email template?
Sample email output from "CreatePrivilegedAccountExceptionEvent.tmpl" under pending folder.
Permission request start date: 14/09/2016 23:59:00 GMT
Permission request is valid until: 16/09/2016 09:00:00 GMT
Answers:
Please change following default coding for start date line in email template as follows.
[default coding]
<br> Permission request start date: <b><%=_eventContextInformation.getSecondaryObjectAttribute("START_DATE", "")%> GMT</b>
[customized coding]
<br> Permission request start date: <b><br>
<% var sd = _eventContextInformation.getSecondaryObjectAttribute("START_DATE", "");
var sdl = new Date;
sdl.setUTCDate(parseInt(sd.substr(0,2),10));
sdl.setUTCMonth(parseInt(sd.substr(3,2),10)-1);
sdl.setUTCFullYear(parseInt(sd.substr(6,4),10));
temp_time = parseInt(sd.substr(11,2),10);
if (temp_time == 24) temp_time = 0;
sdl.setUTCHours(temp_time);
sdl.setUTCMinutes(parseInt(sd.substr(14,2),10));
sdl.setUTCSeconds(parseInt(sd.substr(17,2),10));
%>
<%= sdl.toLocaleString()%> as JST </b>
Sample output of customized coding:
Permission request start date:
September 15, 2016 8:59:00 AM JST as JST