Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
580 views

Display date from JS

Jump to solution

i have some js code wich take data  from SYSATTACHMENTS table, sysmodtime field.

Vvariable is assigned the value like:

 

...
var FileDate = attach.sysmodtime;
...

 

Then i display this FileDate on form (configurationItem.g) and this looks like that:

Thu Feb 09 2017 11:32:06 GMT+0300

How can i change display format to set it like i need, for example:

2017/02/09 11:32:06

or

2017.02.09 11:32:06

...

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Display date from JS

Jump to solution

I found library 

Named - upgradeCommonLib (also there is - smis_CommonLib)

which contains a function to format the date, to  display it by  the template.

 

FileDate = lib.upgradeCommonLib.formatDate(FileDate, "yyyy/mm/dd HH:MM:ss");

 

Function  upgradeCommonlib contains a description about available  usage

View solution in original post

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Display date from JS

Jump to solution

update first message

And screenshot added

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Display date from JS

Jump to solution

Withour more information, I'm not sure how you display it.

but following code may help you, you can transfer the js variable into RAD variable, and the format will change:

var FileDate = new Date();
vars.$G_filedate=FileDate;

Let me know if it helps,

Ling-Yan

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Display date from JS

Jump to solution

Please try the following code and let me know if it works for you or not..

var fileDate1 = fileDate1/1000/60;
var fileDate2 = new XMLDate(fileDate1);
var fileDate3 = fileDate2.getDatum();
print(fileDate3);

 

Regards,

Avi

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Display date from JS

Jump to solution

the result:

[C++ object SCDatum] - 17185 08:10:31

 

If i use (installed on the form, for example) field wich created in DBDICT for table - then i see standart view of DATE format (19/01/17 11:10:30)

But in this case, this is just a variable in Script, may be there is a method to set same date format and for variable ?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Display date from JS

Jump to solution

I found library 

Named - upgradeCommonLib (also there is - smis_CommonLib)

which contains a function to format the date, to  display it by  the template.

 

FileDate = lib.upgradeCommonLib.formatDate(FileDate, "yyyy/mm/dd HH:MM:ss");

 

Function  upgradeCommonlib contains a description about available  usage

View solution in original post

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.