• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Get Data Source Time Stamp

    Scripting general Discussion
    2
    5
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mihairosu
      last edited by

      Please forgive my ignorance, I tried to search the forums but I didn't find any information regarding MetaData points, I think.

      I'd like to poll a data source and get the latest time stamp, so I can display it. I don't mind having to poll a particular data point from that source.

      I'd like to display year, month, day, hour, minute and second, not particularly in that order.

      How can I do this?

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        Hi Mihai,

        For an alphanumeric meta point:

        var then = new Date(p.time);
        return then.getFullYear() + "-" + (then.getMonth()+1) + "-" + then.getDate() + " " + then.getHours() + ":" + then.getMinutes() + ":" + then.getSeconds();
        

        This will have your hours in 24-hour time and your months as numerals. If you want to play with Date objects, you can open your developer tools (right click on a webpage, click inspect element or inspect, find the console) and run "dt = new Date()" and see what functions are available.

        1 Reply Last reply Reply Quote 0
        • M
          mihairosu
          last edited by

          That worked great. Thanks a bunch Phil.

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by

            Except that I shouldn't have added 1 to then.getDate()! Whoops.

            1 Reply Last reply Reply Quote 0
            • M
              mihairosu
              last edited by

              Ah you're right I didn't catch that. The day was off +1. Thanks!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post