3 Replies Latest reply on Jan 19, 2018 9:31 AM by byutz RSS
    byutz Apprentice

    Current time in a service

    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!