Hello,<br><br>I&#39;ve been trying to write a simple JS script, which is called from within the XML dialplan, in order to convert the value of ${created_time} to something more meaningful than UNIX time in ms. The problem is when I try to print something to the console (see log application below), I get NaN (not a number) for variable ${created_date}, even though I don&#39;t want a number (a string is fine, I tried enforcing this with toString()). Moreover, you&#39;ll notice I&#39;ve left out var month = date.getMonth();, because if I don&#39;t I get the following error: TypeError: date.getMonth is not a function. I can&#39;t figure out why, it&#39;s documented in JS in the date object, and the syntax is identical to other functions I use to acquire object values. Any hints would be greatly appreciated, I&#39;ve been trying different code variations for over two hours now and I&#39;m stuck. Thanks.<br>

<br>Here&#39;s the call in the dialplan:<br><br>&lt;action application=&quot;javascript&quot; data=&quot;unixtocal.js $created_time&quot;/&gt;<br><br>And here&#39;s the JS script itself:<br><br>var date = new Date(argv);<br>

var hours = date.getHours();<br>hours = hours.toString();<br>var minutes = date.getMinutes();<br>minutes = minutes.toString();<br>var seconds = date.getSeconds();<br>seconds = seconds.toString();<br>var ms = date.getMilliseconds();<br>

ms = ms.toString();<br>var year = date.getFullYear();<br>year = year.toString();<br>var day = date.getDate();<br>day = day.toString();<br><br>session.execute(&quot;set&quot;, &quot;created_year=&quot;+year);<br>session.execute(&quot;set&quot;, &quot;created_date=&quot;+day);<br>

session.execute(&quot;set&quot;, &quot;created_hours=&quot;+hours);<br>session.execute(&quot;set&quot;, &quot;created_minutes=&quot;+minutes);<br>session.execute(&quot;set&quot;, &quot;created_seconds=&quot;+seconds);<br>

session.execute(&quot;set&quot;, &quot;created_ms=&quot;+ms);<br><br>Then the dialplan takes over again, for example:<br><br>&lt;action application=&quot;log&quot; data=&quot;INFO Date is ${created_date}&quot;/&gt;<br>