LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to format string 03-31-23 15:44 into a time stamp

Personally I have my own special conversion function that uses always %^<%Y-%m-%dT%H:%M:%S>T and then scans the remainder of the string for either a Z character (in which case I'm done) or for a %d:%d tuple which then is converted into seconds and added to the resulting timestamp.

 

If no Z, +, or - follows directly the timestamp it is assumed to be in local time by calculating the local timezone offset for the just generated timestamp and adding that to it. Yes that timestamp could have been generated in a different timezone and really mean a different time in absolute universal time, but hey we have to live with the information we have, I can't invent non-existing information!

Rolf Kalbermatter
My Blog
Message 21 of 28
(847 Views)

@rolfk wrote:

Yes that timestamp could have been generated in a different timezone and really mean a different time in absolute universal time, but hey we have to live with the information we have, I can't invent non-existing information!


Sure you can, Rolf -- if not you, then Who?

 

Bob Schor

0 Kudos
Message 22 of 28
(834 Views)

@Bob_Schor wrote:

@rolfk wrote:

Yes that timestamp could have been generated in a different timezone and really mean a different time in absolute universal time, but hey we have to live with the information we have, I can't invent non-existing information!


Sure you can, Rolf -- if not you, then Who?

 

Bob Schor


If you store UTC and GMT time different (and daylight saving correction info), you can correct for this.

 

It's somewhat surprising that timestamps are often ignored by customers.

 

Sometimes there's just no way around it...

 

If the data 'travels' around the world, you better think this through in advance. UTC is consistent, but not very user friendly. If a measurement was done at lunch, you might want to see lunch times. However, if you want to synchronize data with local measurements, you might want to show the data as local time. 

 

It can get very difficult. It's esp. difficult to explain to customers\users why it's difficult.

0 Kudos
Message 23 of 28
(794 Views)

wiebe@CARYA wrote:

@Yamaeda wrote:

@mshaska wrote:

How do I format 03-31-23 15:44 into a time stamp format?


Something like %<dd-mm-YY HH:MM>T


%<%d-%m-%Y %H:%M>T actually.


That's what happens when you write from a bad memory. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 24 of 28
(788 Views)

@Yamaeda wrote:

wiebe@CARYA wrote:

@Yamaeda wrote:

@mshaska wrote:

How do I format 03-31-23 15:44 into a time stamp format?


Something like %<dd-mm-YY HH:MM>T


%<%d-%m-%Y %H:%M>T actually.


That's what happens when you write from a bad memory. 🙂


I still look them up...

 

We could have a lengthy discussion on how to find them easily. I drop a Format Date/Time String, Detailed Help, Time Format Codes (at the bottom).

 

Finding them through the format into string or scan from string function's detailed help is harder (Detailed Help, Format Strings, Format Codes for the Time Format String (under "<Embedded Time Format> (optional)>").

 

 

Message 25 of 28
(781 Views)

Not sure what is the problem, but I just tried to send an answer and the mighty Cloudflare service seems to really dislike something about me. 😁

 

Was just saying that I handle it as Wiebe. No matter what I try, I end up being in doubt every time again and have to look it up anyhow. 😁

Rolf Kalbermatter
My Blog
0 Kudos
Message 26 of 28
(766 Views)

@rolfk wrote:

Not sure what is the problem, but I just tried to send an answer and the mighty Cloudflare service seems to really dislike something about me. 😁


I got that too: You have been blocked? - NI Community

 

Must be the way we lookup time formatting 😂.

0 Kudos
Message 27 of 28
(756 Views)

wiebe@CARYA wrote:

We would have a lengthy discussion on how to find them easily. I drop a Format Date/Time String, Detailed Help, Time Format Codes (at the bottom).

 

Finding them through the format into string or scan from string function's detailed help is harder (Detailed Help, Format Strings, Format Codes for the Time Format String (under "<Embedded Time Format> (optional)>").


Hear, hear! Is there any other way? 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 28 of 28
(738 Views)