LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert timestamp to string with milliseconds showing.

I have two questions. The first is I need to know how to convert the timestamp that displays from "Get Date/Time in seconds" to a string format.  I found the vi that converts to string but it stops at seconds and cuts off the milliseconds. I wired true to the "Get seconds" terminal so I get the time in seconds, I just don't get the millisecond value. Also I need to know if the clock from "Get Date/Time in seconds", is synchronized (or shows the same time down to the millisecond) with the timestamp that shows in the CAN read vi. I need to have the clock/timestamp from the CAN read synchronized with the "Get Date/Time in seconds" clock/timestamp. I am trying to compare delays in the CAN so I need precision down to the millisecond.
0 Kudos
Message 1 of 10
(49,248 Views)
Instead of Get Date/Time in Seconds, Use Format Date/Time String. To display hours, minutes, seconds, milliseconds, use a format string of %H:%M:%S%3u.
Message 2 of 10
(49,233 Views)
Use Format Date/Time String.  For the format code use %H%M%S%4u to get two digits for hours, two digits for minutes, two digits for seconds, then a decimal, and after the decimal you get 4 digits for fractions of a second.  Replace the 4 with a 3 to get milliseconds, or with a 1 to get tenths of a second.   You get the idea...  See attached vi.
- tbob

Inventor of the WORM Global
Message 3 of 10
(49,231 Views)
I had a long, incorrect, post.   Never mind,    as was said to me in an earlier post, not enough coffee for the LV_Pro today. Forgot all about doing it that way.
 
P.M.
 

Message Edited by LV_Pro on 07-20-2005 04:20 PM

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 10
(49,230 Views)
I need to know how to synchronize the "Get Date/Time in seconds" timestamp with the timestamp that shows in the CAN read vi.  I am trying to compare delays in the CAN so I need to be able to look at the clock that I have running with my encoder and look at the clock running with CAN and see that they both display the exact same time.
0 Kudos
Message 5 of 10
(49,202 Views)
PhilGil,

The problem with this approach is the timestamp value that is returned from the Get Date/Time VI is coming from your Windows PC whereas the timestamp that you see in your CAN frames comes from the CAN hardware. I'm not sure how different the values would be but they indeed are coming from two different sources. Do you happen to have a LabVIEW RT system?

Craig H.
0 Kudos
Message 6 of 10
(49,179 Views)
Thanks for all the help. I have one more question. I am reading an encoder using DAQ digital channels.  I am outputing what the encoder reads to a text file. I have precision at .1 and I need to coerce the values to be at intervals of .5. example if the number is 2.8 i want to see 3 in the file or if the number is 1.3 i want 1.5.
0 Kudos
Message 7 of 10
(49,164 Views)
Multiply by 2, then Round To Nearest, then divide by 2.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 10
(49,145 Views)

How can i convert current time into the number of seconds since the beginning of the day? thanx)

0 Kudos
Message 9 of 10
(35,558 Views)

Hi Kolesnikov,

 

some simple math will help:

check.png

 

Next time you should create a new thread instead of highjacking a 9 year old one…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(35,550 Views)