Have you ever wanted to add relative time to a time stamp data type in LabVIEW? You can easily do this by adding a floating point to the time stamp, as shown below.
The units are in seconds and, as you can see, Time Stamp out is one second greater than Time Stamp (in) as we would expect.
This is pretty cool, but we can do something even cooler! Let’s use the units feature of LabVIEW to specify relative time in units other than seconds. First, make the Unit Label of the relative time constant visible by right-clicking on it and choosing Visible Items>>Unit Label. While the unit label has the cursor, type the letter “d” to set the units as days. Your VI should now look like the Block Diagram shown, below:
Run the VI and you’ll see that Time Stamp out is one day greater than Time Stamp (in) as we would expect.
Other units of time are
- “a” (year)
- “h” (hour)
- “min” (minute)
- “s” (second)
Give some of these a try and see how they work
If you liked this tip then you should check out, LabVIEW for Everyone. It’s chalk full of great LabVIEW tips and tricks that I’ve learned over the years.