How Do I Add A Day To My LabVIEW Timestamp?

Updated Aug 18, 2023

Reported In

Software

  • LabVIEW

Issue Details

I want to programmatically increment a timestamp by one day in LabVIEW.  How do I get the next day from my current day's timestamp?

Solution

There are two solutions for this:
  • You can add seconds to the current day's timestamp.  If you add 86,400 to it then you will go one day in the future.  Please be aware, that this approach is not fail-safe. If you're in a country that uses daylight saving time (summertime), this approach might shift the time of the day by one hour.
  • If you want to add a day to your timestamp and always end up on the same time of the day independent of the time of the year, you need to manually overwrite the time of the day. The Date/Time to Seconds and Seconds to Date/Time VIs can help you with that.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Additional Information

When working with timestamps in bigger architectures it is recommendet to work with UTF (external link: Universal Time Format) only. When displaying the time, a conversion to the local time format should be done. This way you don't need to worry about winter- and summertime, and your data is seperated from the UI-Style.