Java transform ms to s

I have a number item and the raw value is in milliseconds and i would like to Convert that to seconds.
Number Kontor_timer_Aktuel_tid "tid [JS(conv-ms-to-s.js):%s ms] "

.js file
(function msto2(ms) { return (ms / 1000); })(input);

Site map:
Text item=Kontor_timer_Aktuel_tid label="tid tilbage"

On the site map the value is shown but have not been converted.
i have installed the Javascript transformtion app-onPreformatted text

The Item state value will be passed to the transform as a string.
I think you’d need to use parseFloat() or parseInt() on that string before doing any maths operations on it.

Thanks it works now.

   (function msto2(i) {
    var d=parseInt(i) /1000
    return d;