From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-22-2010 12:10 PM
Hello, everyone. I have a question on formatting time in numerical values (double 64-bit) to specific format.
An example: 1013.49700, which is converted to excat format of "hhmmss.sss". In this case, hh=00, mm=10, ss.sss=13.497
So, I want 001013.497. Are there any way(s) to do this? Thanks a lot.
Regards,
yukfai88
03-22-2010 12:46 PM
I believe you want the format string %<%H%M%S%3u>T
You can use the Advanced editing mode under the Display Format tab of a datetime stamp to see the full setof date time options...
03-22-2010 07:51 PM
Hi Philip,
the format is what I want, by having the format of hhmmss.sss, but I don't know why the numeric value of "84843.896" will be converted "073403.896". Are there way(s) to restore the original time? Thank you.
Regards,
yukfai88
03-22-2010 11:03 PM - edited 03-22-2010 11:04 PM
Where did 84843.896 come from?
Why don't you post your VI as it stands right now.
And what do you mean by "restore the original time"?
03-23-2010 02:08 AM
Hi yukfai,
your numbers aren't real time values. LabVIEW counts time in seconds, so 1013.4 is a time in seconds or 16m53s400ms.
To convert your numbers you have to split them into separate values for h,m, and s by using some modulo operations (hours = x \ 10000, minutes = (x - 10000*hours)\100 and so on...)!
03-23-2010 03:22 AM - edited 03-23-2010 03:25 AM
GerdW wrote:Hi yukfai,
your numbers aren't real time values. LabVIEW counts time in seconds, so 1013.4 is a time in seconds or 16m53s400ms.
To convert your numbers you have to split them into separate values for h,m, and s by using some modulo operations (hours = x \ 10000, minutes = (x - 10000*hours)\100 and so on...)!
Or use the formating string as shown by Phillip Brooks. But I would change it to %<%H%M%S%3u>t since the OP seems to be interested into relative time formatting rather than absolute time formatting.
The difference is that relative timeformatting is the seconds since 00:00:00 while absolute time formatting is the seconds since January , 1904 UTC, 00:00:00. This means that when you use absolute time formatting, the current timezone offset will be calculated in before the time is displayed.
03-23-2010 05:30 AM
Hi rolfk,
yukfai wants this:
"1013.49700, which is converted to excat format of "hhmmss.sss". In this case, hh=00, mm=10, ss.sss=13.497 So, I want 001013.497"
As said before: 1013.497 will result in 0h 16m 53s 497ms when using internal timestamp formatting. But the user wants to display 0h 10m 13s 497ms! So he has to "split" the number using modulo operations.
@yukfai:
Could you please clarify what is the expected result for "84843.896"? Is it 8h 48m 43s 896ms or 23h 34m 3s 896ms?
03-23-2010 08:22 AM
Thanks for help, GerdW and rolfk.
My desired output from numerical value of 84843.896 is in 08h 48m 43s 896ms. But I can't simply convert it to the form of having 6 digits before decimal point and three digits after the decimal point. Are there any format code to achieve this? Thanks a lot.
Regards,
yukfai88
03-23-2010 08:27 AM
03-23-2010 09:07 AM