LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time/Date string to seconds?

Thanks Frozen for the "Edit" and credit...

Also thanks for posting a proper screen capture (I don't have LabVIEW installed on my "Internet Computer".)

 

What I thought was most interesting is the ability to just Use %T and not have to remember all that formatting gobbly gook (%<%Y-%m-%d .....).

Cheers

Certified LabVIEW Developer
LabVIEW 7.1 - Present
0 Kudos
Message 11 of 21
(1,676 Views)

Watch out with the %T formatting!!!!!

 

That will use whatever the current locale is configured for and can vary between computers greatly and even on the same computer between user profiles.

Not a problem if it is just about reading back the file right after it is created but certainly going to bite you if your application is meant to create data files for archiving and read back later from different users.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 12 of 21
(1,660 Views)

FYI just for fun.

 

This thread is now the current record-holder in the zombie thread revival thread, a meta-discussion about whether old threads should be locked after a period of inactivity.

 

(More discussion available if you follow the link, but I'l summarize my own thoughts here:  nope, don't lock 'em.  Searches turn up old threads and some old threads benefit from correction or expansion, like this new record-holder here for instance.)

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 13 of 21
(1,644 Views)

Ooooo, I like shiny things and helping or creating world records!

Now another thread I commented on that was created in 2012 has to have some kind of record!

It's 54 pages of comments and I get emails almost daily on it...

https://forums.ni.com/t5/Certification/Sample-Exam-Solutions-for-Review/td-p/1824703

 

       Thanks for that disclaimer on usage of %T, awesome good to know info!!

Certified LabVIEW Developer
LabVIEW 7.1 - Present
0 Kudos
Message 14 of 21
(1,591 Views)

Heeeeey!

 

Here's my contribution to keeping this record alive:

 

I have ISO-8601-Timestamps like 2026-02-04T08:15:53.645748 in my log data and need them to be Labview Timestamps. Using the method suggested by Frozen, unfortunately doesn't work for me (...or anymore?). I tried it with the "T" between Date and Time aswell with it being replaced by whitespace to match Frozens example. Neither works and i get Error 1. Can anybody help? I can't relate the error message to my problem, as i don't see any weird characters in my strings.

 

Roumaenski_0-1776680231610.png

Roumaenski_1-1776680253778.png

 

I am on Version 2026 Q1 (32-bit) 26.1f0 - thank you very much in advance!

0 Kudos
Message 15 of 21
(117 Views)

@Roumaenski  ha scritto:

Heeeeey!

 

Here's my contribution to keeping this record alive:

 

I have ISO-8601-Timestamps like 2026-02-04T08:15:53.645748 in my log data and need them to be Labview Timestamps. Using the method suggested by Frozen, unfortunately doesn't work for me (...or anymore?). I tried it with the "T" between Date and Time aswell with it being replaced by whitespace to match Frozens example. Neither works and i get Error 1. Can anybody help? I can't relate the error message to my problem, as i don't see any weird characters in my strings.

 

Roumaenski_0-1776680231610.png

Roumaenski_1-1776680253778.png

 

I am on Version 2026 Q1 (32-bit) 26.1f0 - thank you very much in advance!


Maybe the decimal separator of your OS is the comma?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 16 of 21
(108 Views)

Hey Paolo,

 

thank you for replying. It is the comma but where in the code do i have to account for that? I don't see any decimal-character at all in the code resp. the format string. Seconds and its fractions / the 6 digits after the decimal point are not separated in the format string as i understand.

0 Kudos
Message 17 of 21
(98 Views)

@Roumaenski wrote:

thank you for replying. It is the comma but where in the code do i have to account for that?


Depending on the actual string you are reading, put %.; or %,; at the beginning of your format string. This will force the localization code use or a period or comma respectively for the decimal separator.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 18 of 21
(85 Views)

Hey crossrulz,

 

thanks for the input! Would you be so kind to tell me where exactly i have to put "%." in this format-string?

 

-> %<%Y-%m-%dT%H:%M:%S%6u>T

 

Sorry for asking, i still struggle to understand how those strings work resp. how to set them. When i tried several positions, i got the error that there are too many specifiers or it simply didn't work. Thank you!

0 Kudos
Message 19 of 21
(76 Views)

@Roumaenski wrote:

Hey crossrulz,

 

thanks for the input! Would you be so kind to tell me where exactly i have to put "%." in this format-string?

 

-> %<%Y-%m-%dT%H:%M:%S%6u>T

 

Sorry for asking, i still struggle to understand how those strings work resp. how to set them. When i tried several positions, i got the error that there are too many specifiers or it simply didn't work. Thank you!


As he stated, "put %.; or %,; at the beginning of your format string"

 

Example: %,;%<%Y-%m-%dT%H:%M:%S%6u>T

 

 

 

 

 

 

Message 20 of 21
(69 Views)