Highlighted
Super Contributor.
Super Contributor.
950 views

Date and Time format in html templates

Jump to solution

Hi Experts,

 

I'm using {$RECORD.planned_start} in a html template for which I am getting value as  "Wed Aug 26 2015 00:00:00 GMT -0300 (Argentina Standard Time)"  but actual planned.start of the ticket is "26/08/2015 00:00:0".

 

It's SM 9.34 and, In the info file, the time.zone field is set to Argentina/Bs.As  and  date.order field is set to dd/mm/yy

 

Can anyone please tell me why am getting Wed Aug 26 2015 00:00:00 GMT -0300 (Argentina Standard Time) in planned.start and what should i do to get the same planned.start as in Ticket.

 

 

Please help me.

 

Thanks in Advance..

Good questions will have Good answers
0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Date and Time format in html templates

Jump to solution

So, the values in the HTML format get generated as the system passes data to Javascript.  Javascript takes the HPSM date information and translates that to Javascript date information, which is the long version of the date (Day Month Day Year Time Timezone).

 

So, to get the value to display in the Service Manager format of date/time, you need to do some manipulation in the Expressions tab.

 

So, for your example, in the Expressions tab, have something like

 

var plannedStart = new XMLDate($RECORD.planned_start).getSCDateTimeString()

 

and then, in your HTML Source, where you have {$RECORD.planned_start}, use this new variable instead {plannedStart}

View solution in original post

6 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Date and Time format in html templates

Jump to solution

So, the values in the HTML format get generated as the system passes data to Javascript.  Javascript takes the HPSM date information and translates that to Javascript date information, which is the long version of the date (Day Month Day Year Time Timezone).

 

So, to get the value to display in the Service Manager format of date/time, you need to do some manipulation in the Expressions tab.

 

So, for your example, in the Expressions tab, have something like

 

var plannedStart = new XMLDate($RECORD.planned_start).getSCDateTimeString()

 

and then, in your HTML Source, where you have {$RECORD.planned_start}, use this new variable instead {plannedStart}

View solution in original post

Highlighted
Super Contributor.
Super Contributor.

Re: Date and Time format in html templates

Jump to solution

Thanks Jacob.

I've tried, in Expressions,  the    var plannedStart = new XMLDate($RECORD.planned_start).getSCDateTimeString();

and then referenced it as :

{plannedStart}

    following your instructions but it doesn't work

 

In the ScriptLibrary  table i haven't found  XMLDate   or   getSCDateTimeString   (or something similar) .

 

thanks in advance

Good questions will have Good answers
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Date and Time format in html templates

Jump to solution

Can you show me a screenshot of what you have set up?  Because the code I gave you _does_ work.

 

As for finding the ScriptLibrary for XMLDate or getSCDateTimeString() - those aren't scripts, they are data types and functions.  Use the built-in help documentation and perform a search for either of those terms and you'll get information.

 

The script that turns the information in your HTML Email Template record into an email is going to be 'htmlemailtemplates', but you won't have to modify that script.  All of the manipulation will be in the expressions of your email template record.

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Date and Time format in html templates

Jump to solution

Thanks again Jacob,

I'm attaching a screenshot.

 

 

Good questions will have Good answers
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Date and Time format in html templates

Jump to solution

Awesome.  Thanks for the screenshot.

 

So it's not using the {plannedStart}, but still using the {$RECORD.planned_start}... after making the change, did you save the record?  Because attached, you can see what the same code looks like in my environment.

 

 

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Date and Time format in html templates

Jump to solution

Awesome. It works (I've done it all again, copying/pasting, saved, logout/login)

 

Thank you very much  Jacob

 

Have a good day.

Good questions will have Good answers
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.