Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

converting milliseconds into proper time format

VigneshMC
Mega Sage

Any idea on how to convert the millisecond value into hrs min and sec format using client script?

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Hi Vihnesh,



Try this on a background script, if it works fine for you then use it


var gdt = new GlideDateTime();


gdt.setNumericValue(1314777600000);


gs.print(gdt.getValue());


-Anurag

In Jakarta, this works fine in the global scope.   But it does not work in a scoped application.   Has anyone found a workaround?   I'm thinking of messing around with Javascript Date...


peterh_smith
Tera Contributor

I ended up using the browser's javascript support on the client side.  



Date - JavaScript | MDN



It worked out fairly well.   From my UNIX days, I have been trying to do date calculations in ms since the epoch UDT.   If you are on the server side, it looks like the GlideDate[Time] and Duration classes really want to operate using strings in local time, except when building a filter.   Also, there are useful filter-related methods on GlideSystem.


Abhishek316
Tera Contributor

Ignissta Convertitore da ost a pst è il miglior convertitore OST to PST sul mercato. Offre una semplice interfaccia utente e la capacità di convertire file OST grandi in pochi minuti. Inoltre, mantiene la struttura originale dei file e recupera anche i dati eliminati. Il software è compatibile con tutte le versioni di Outlook e Windows. Inoltre, offre la possibilità di esportare i dati convertiti in vari formati come PST, MBOX, EML, MSG e Vcard. Ignissta Convertitore da ost a pst è un'ottima scelta per chiunque abbia bisogno di convertire i propri file OST in PST.

 

OST CONVERTER BIG IMAGE.png