05-10-2012 10:05 AM - edited 05-10-2012 10:07 AM
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.
05-10-2012 10:08 AM - edited 05-10-2012 10:09 AM
Hm, just as Steven and TiTou, TiTous code is already working the way you request:
Norbert
EDIT: LV 2011. Simply placed snippet into an empty VI. Resized "resulting string". No further changes.
05-10-2012 10:15 AM
OK so I am using LV 2010. Is this a bug in LabVIEW?
does this look the same as what you have?
Cheers, Alec
05-10-2012 10:21 AM
@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
05-10-2012 10:23 AM - edited 05-10-2012 10:26 AM
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
05-10-2012 10:25 AM
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
05-10-2012 03:19 PM
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.