LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add time to string timestamp

Solved!
Go to solution

Hello,

I have a problem with adding time to string timestamp that is shown on image below.

 

Capture.PNG

What I need is to add some time eg. 1 hour, but if that change happens between 23:00 and 00:00 I need to change date to. 

 

Wanted results for example:

14:53, 22.4.2015. --> 15:53, 22.4.2015. 

23:33, 22.4.2015. --> 00:33, 23.4.2015.

 

Please help

0 Kudos
Message 1 of 7
(4,772 Views)
Use actual timestamps instead of strings. Explain why you think that strings should be used.
0 Kudos
Message 2 of 7
(4,747 Views)
Solution
Accepted by topic author SuperbrainBug

Use the Get Date/Time in Seconds function to get the time, use this form to add and subtract time (to add an hour, simply add 60*60 seconds), and use the Time-Stamp input to the Format Date/Time function when you want a String implementation.

Time Example.png

Bob Schor

 

Message 3 of 7
(4,744 Views)
Solution
Accepted by topic author SuperbrainBug

1 - use timestamps instead.

2 - if you are stuck with strings because they are coming from elsewhere, convert back into a timestamp to do the math

 

time add.png

Message 4 of 7
(4,739 Views)
Solution
Accepted by topic author SuperbrainBug

Here are two ways.  One adds a time value from string, the other adds a time value from a double.

Add Timestamp String.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 5 of 7
(4,730 Views)

Hello,

 

@

 

 

Thank you for help. This was exactly what I needed.

 

Bye

0 Kudos
Message 6 of 7
(4,688 Views)
Just because you have end up with strings does not mean you can't start with the correct data type.
0 Kudos
Message 7 of 7
(4,673 Views)