Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello all,
I have what seems like it should be a simple question, but I cant seem to find the answer to it. I have an event that triggers a subscription. I have with it the start time of a cycle of a machine, and I would like to get the cycle duration. I am not being sent up the cycle stop time, so I am going to have to use the current time-cycle start. How can I get the current time in my service? I have tried
var currentdate = new Date();
var result=currentdate.getDate()
and it gives me a time in 1969 haha. Is there an easy way to get the current time stamp? It should be easy because anytime a property is logged it is used, but I am stumped!
Thank you!
Solved! Go to Solution.
Just found the answer!
var currentdate = Date.now();
var result=currentdate
Just found the answer!
var currentdate = Date.now();
var result=currentdate
Just doing this also works:
var now= new Date();
result=now;
Thingworx 5.0+ get current date and time using Javascript source code
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS218294