Example Code

How to get Milliseconds or Microseconds from a Timestamp

Code and Documents

Attachment

Overview
This examples shows how to get milliseconds or microseconds from a timestamp.

 


Description
This examples shows how to get milliseconds or microseconds from a timestamp. The timestamp can be decoded to provide fractional seconds. The resulting fraction seconds can then be converted to milliseconds or microseconds in a double format. The Timestamp to Milliseconds VI attached has the following terminals on it's connector pane:

Inputs:

    Timestamp In (Timestamp) * Required Input

    Milliseconds (T, Default) or Microseconds (F)

Outputs:

    Time String (String)

    Hours (Double)

    Minutes (Double)

    Seconds(Double)

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI "Timestamp to Milliseconds 2012 NIVerified.vi"
  3. Set the Timestamp In and Milliseconds or Microseconds
  4. Run the VI

 

Additional Information or References
VI Snippet

 Block Diagram.PNG

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Regards,

Mike Altmann
Product R&D
NI

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
taper
Member
Member
on

This doesn't show the value of Seconds, just Hour, Minute, and Fractional Seconds. You need to add %S to the format string.  Is there any benefit to using this VI instead of Seconds to Date/Time from the timing palette or Format Date/Time String with %H:%M:%S%8u?


--Using LV8.2, 8.6, 2009, 2012--