LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String To Time Stamp including milliseconds

Solved!
Go to solution

Then TiTou's snippet he posted sure seems like it is doing what you want.

 

If you aren't getting that, then you programmed something wrong.

0 Kudos
Message 11 of 17
(1,162 Views)

Hm, just as Steven and TiTou, TiTous code is already working the way you request:

TimestampString.PNG

 

Norbert

 

EDIT: LV 2011. Simply placed snippet into an empty VI. Resized "resulting string". No further changes.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 12 of 17
(1,159 Views)

OK so I am using LV 2010. Is this a bug in LabVIEW?

does this look the same as what you have?

Cheers, Alec

 

untitled.JPG

0 Kudos
Message 13 of 17
(1,156 Views)

@alecjcook wrote:

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


I'm sorry I don't get this with the VI I posted...

 

What I get is this :

if you enter 1 you get .001

if you enter 10 you get .010

if you enter 100 you get .100

 

if you enter 5 you get .005

if you enter 15 you get .015

if you enter 150 you get .150


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

Epictetus

Antoine Chalons

0 Kudos
Message 14 of 17
(1,153 Views)
Solution
Accepted by alecjcook

No bug, you just made a small mistake. the first format string should end with %03d and in your VI it ends with %d.

 

That kind of small mistake is really are to spot sometimes, hence why I made a snippet (PNG file that you can drag into your block diagram to get the code!


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

Epictetus

Antoine Chalons

Message 15 of 17
(1,151 Views)

You've neglected to match the initial formatting string that TiTou used, which is the key to your issue.  The string

 

%<%Y-%m-%d>T %d:%d:%d.%d

 

should be replaced with

 

%<%Y-%m-%d>T %02d:%02d:%02d.%03d

 

Although it's actually just that last segment %03d that is causing the issue you see.  By using %d, you are telling the formatter to use as few digits as possible to display the number, thus showing 1 as 1, 10 as 10, and 100 as 100.  %03d tells the formatter to always use three digits and replace the leading digits with 0s, thus 1 shows as 001, 10 as 010, and 100 as 100.

 

Best wishes,

Steven I


Steven I
Message 16 of 17
(1,149 Views)

You really should mark Titou's message as the solution to your problem rather than the previous message.  He is the one who gave you the solution.  Sisrael, me, and several others just pointed out that you must have implemented TiTou's solution incorrectly.

 

You need to go to the options menu to the upper right of Sisrael's message and select Unmark as Solution first.  Then you can correctly mark Titou's message as the solution.

0 Kudos
Message 17 of 17
(1,135 Views)