# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## String To Time Stamp including milliseconds

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

Message 1 of 17
(4,771 Views)

## Re: String To Time Stamp including milliseconds

Hi,

This should be enough

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,764 Views)

## Re: String To Time Stamp including milliseconds

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"

Message 3 of 17
(4,753 Views)

## Re: String To Time Stamp including milliseconds

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

Message 4 of 17
(4,750 Views)

## Re: String To Time Stamp including milliseconds

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

Message 5 of 17
(4,742 Views)

## Re: String To Time Stamp including milliseconds

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
Message 6 of 17
(4,734 Views)

## Re: String To Time Stamp including milliseconds

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

Message 7 of 17
(4,733 Views)

## Re: String To Time Stamp including milliseconds

well no.

if its 1 i want 001, if its

if its 10 i want 010

if its 100 i want 100 ...

Message 8 of 17
(4,722 Views)

## Re: String To Time Stamp including milliseconds

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

Message 9 of 17
(4,718 Views)

## Re: String To Time Stamp including milliseconds

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

Message 10 of 17
(4,715 Views)