LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String To Time Stamp including milliseconds

Solved!
Go to solution

Hi, The below image show me converting the time into a timestamp (and substituting the date from a different time stamp.

This works fine except for the miliseconds. you can see here the milliseconds are defines as "%2d" and this does not work. If I replace this with "%2u" or "%3u" then the VI will error (vi attached)

what am i doing wrong

Cheers, Alec

TimeStamp

0 Kudos
Message 1 of 17
(4,427 Views)

Hi,

 

This should be enough

 

Add Time to Timestamp_BD.png

 

Hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 17
(4,420 Views)

OK, NEARLY! and Thanks 🙂

The problem now, is the number i am inputting is milliseconds, and the time stamp number is fractions of a second.

 

ie. "1" and "100" both translate to 00:00:00.100

 

anyone know how to translate this? 

 

how would i make the time "00:00:00.001"

0 Kudos
Message 3 of 17
(4,409 Views)

Sorry I don't understand what you're asking for...

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 17
(4,406 Views)

using this vi. if you set miliseconds to 1, the (and the time is set to say 12:30:15 (12hrs, 30min, 15sec) then you get 12:30:15:1.

 

What do i need to do to set the time to "12:30:15.001"

 

so not 0.1 but 0.001 

0 Kudos
Message 5 of 17
(4,398 Views)

Hello,

 

  It sounds like your formatting string is off.  In the last part of the first string in TiTou's example, note that the string is .%03d rather than just .%d

 

This makes a big difference in the final result.  I tried TiTou's code myself and entering 1 in the milliseconds produces .001 as expected.

 

Best wishes,

Steven I


Steven I
0 Kudos
Message 6 of 17
(4,390 Views)

Oh...

 

so if it's 1 you want .100

so if it's 10 you want .010, right?

and if you have 100 what do you want? .001? if not, what would give you .001?


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 17
(4,389 Views)

well no.

if its 1 i want 001, if its

if its 10 i want 010

if its 100 i want 100 ...

0 Kudos
Message 8 of 17
(4,378 Views)

well... is this not what you get with the VI I posted in my first answer?


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 9 of 17
(4,374 Views)

no,

if you enter 1 you get .1

if you enter 10 you get .1

if you enter 100 you get .1

 

if you enter 5 you get .5

if you enter 15 you get .15

if you enter 150 you get .15

 

i cant see how you can get .005

0 Kudos
Message 10 of 17
(4,371 Views)