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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add 1 month to a timestamp date?

Trivial

mp1.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 21 of 27
(1,461 Views)

Hi Paul,

 

maybe you want to add 1 before the QR operation!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 27
(1,453 Views)

@GerdW wrote:

Hi Paul,

 

maybe you want to add 1 before the QR operation!?


No, it's correct as is.  Months are 1-based, not 0-based; so the QR has to happen before the add.

"If you weren't supposed to push it, it wouldn't be a button."
Message 23 of 27
(1,432 Views)

Hi paul,

 

you're right!

I'm used to increment first followed by QR to limit to allowed range…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 24 of 27
(1,418 Views)

You can try the same aproach i used in a project of mine, using some native timestamp vis

image.png

 

 

0 Kudos
Message 25 of 27
(1,271 Views)

@Vitor_Miranda wrote:

You can try the same aproach i used in a project of mine, using some native timestamp vis

image.png


Which LabVIEW version are you using? Have you tried to run this right now (month is 12 now)? At least in LabVIEW 2016 running this code will produce a null timestamp! So maybe they changed something in the last LabVIEW version to normalize the time cluster before converting it in a timestamp, but it is not a safe recommendation for at least until LabVIEW 2016.

Rolf Kalbermatter
My Blog
0 Kudos
Message 26 of 27
(1,259 Views)

@rolfk wrote:

 


Which LabVIEW version are you using? Have you tried to run this right now (month is 12 now)? At least in LabVIEW 2016 running this code will produce a null timestamp! 


2018 SP1 F1 is the same, that method is not recommended, that is unless you know you don't run tests in December, or any on the 29th, 30th, or 31st of any month.

0 Kudos
Message 27 of 27
(1,255 Views)