Display date from JS

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

...

Parents Reply Children
  • 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 ?

  • Verified Answer

    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