LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simplifying Date/Time Functions in LabVIEW

Solved!
Go to solution

Hi all,

I have a VI where I’m using the “Get Date/Time In Seconds” function wired to a “Get Date/Time String” function. LabVIEW suggests that I could replace these two functions with a single “Get Date/Time String” to simplify the code.

I’m not entirely sure if I’m missing something, or if replacing it could affect other parts of my VI.

I’ve attached two images for reference:

  1. The part of my block diagram where these functions are used.

  2. The VI Analyzer output showing the suggestion.

Could someone confirm whether it’s safe to just use “Get Date/Time String” alone, and if there are any caveats I should be aware of?

Thanks in advance!

0 Kudos
Message 1 of 6
(426 Views)

Hi Hilter,

 


@HIlter wrote:

I’ve attached two images for reference:

  1.  

No, you did not…

 


@HIlter wrote:

Could someone confirm whether it’s safe to just use “Get Date/Time String” alone, and if there are any caveats I should be aware of?


Read the help for that function to learn about its default input value.

That's all you need to know…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(409 Views)
Solution
Accepted by topic author HIlter

@HIlter wrote:

Could someone confirm whether it’s safe to just use “Get Date/Time String” alone, and if there are any caveats I should be aware of?


Using "Get Date/Time String" with an unwired timestamp has one caveat, because of this bug still present in LV2025 Q3:

https://forums.ni.com/t5/LabVIEW/Get-Date-Time-String-unexpected-rounding/td-p/4392916

 

If you require a timestamp string that is accurate to the second, I would recommend to either keep your code as it is (wiring the output of "Get Date/Time In Seconds" to the input of "Get Date/Time String"), or use "Format Date/Time String" instead, as shown in the linked thread.

 

Regards,

Raphaël.

Message 3 of 6
(383 Views)

@HIlter wrote:

I’m not entirely sure if I’m missing something, or if replacing it could affect other parts of my VI.

 


You already got excellent advice, so I won't repeat all that. If you deal with dates/times as strings, we can assume that further use is more cosmetic than anything and I doubt you later want to do millisecond math with it.

 

If you "follow the wire" what kind of downstream code depends on these strings. Also, where in relation to all other running code, do you get these strings and how often?

 

Can you attach the full VI?

 

Just a curiosity:

It is interesting that the icon shows January 1989 which places it somewhere between LabVIEW 1 and 2, but it is also possible that this was an attempt a "future-proofing" from the beginning. :D.

 

altenbach_0-1764614410219.png

 

 

0 Kudos
Message 4 of 6
(323 Views)

@HIlter wrote:

You really should change your username it's too close to another name.

Message 5 of 6
(275 Views)

@mcduff wrote:

@HIlter wrote:

You really should change your username it's too close to another name.


It is also a seemingly nice community in Germany as well as a family name originating in Scotland. 🙂

Message 6 of 6
(266 Views)