Announcement

Collapse
No announcement yet.

hs.LastDeviceChange - return time only?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    hs.LastDeviceChange - return time only?

    Not sure where to post this..

    I'm using HSTouch to display the Last Change time of some devices for tracking. But I really want to just display the time, not the entire date+time string. I'm new to scripting and not sure how to handle this, to modify the result of

    [$SCRIPT=&hs.DeviceLastChange("v18")]

    to give me what I want. I can do tricks in Excel with its functions in my sleep, but this teeny bit of vb is a bit fresh for me, and I couldn't find my answer in searching posts back to 2011.

    Otherwise I'm left to have my whole field at the left of the display, slid even further left so I only see the time... except whenever the date creeps into view on certain days. Annoying for sure.

    Thanks much
    Darrel

    #2
    Try...

    [$SCRIPT=&FormatDateTime(hs.DeviceLastChange("V18"),4)]

    There are some alternate conversions here http://www.w3schools.com/vbscript/fu...atdatetime.asp

    Comment


      #3
      PERFECT!!! That's exactly what I wanted. I was thinking in terms of string modifiers like RIGHT, MID, etc. This worked!

      THANKS!

      Comment


        #4
        No worries...nothing to stop you doing a mid if you wanted to but there could be some formatting issues. You can do most single line VBScript (don't think you can do anything .net but not sure) commands inside the [$SCRIPT tags.

        Comment


          #5
          mrhappy,
          I'm trying to get the time (including seconds) into an email. How do I use this
          [$SCRIPT=&FormatDateTime(hs.DeviceLastChange("V18"),4)]
          to get the last change of a device reported in an email?
          I think to get seconds, I replace the 4 with a 3. The device I'm trying to monitor last change is device code "&1".
          Thanks

          Comment

          Working...
          X