08-08-2017 11:20 AM
In my program I want to email the save file from the previous hour (this is because my file stays open and gets more info during the current hour). I have the date format as \%m%d%y_%H and didn't know how to change it to that format but one hour prior?
Thank you!
Let me know if you need more info
Solved! Go to Solution.
08-08-2017 11:36 AM
If you are using a timestamp value, subtract 3600.
08-08-2017 11:38 AM
Just subtract 3600 (number of seconds in an hour) from your current time.
08-08-2017 12:00 PM
I have one more question, how would I put that in a case structure that will run only hourly. Is the "Wait(ms)" function the way to go?
08-08-2017 12:17 PM
Using the Wait (ms) function for such a long wait time is not a good idea. What if your program needs to stop early, before the hour is up? There is no way to stop the wait. Instead, you should write logic to check what time you started waiting and see if an hour has passed in a loop.
Here is an example of how to do this. I've put an event structure in to show you how you can respond to other events while you are waiting, such as the need to stop early.
05-22-2018 07:43 PM
I just found that you can also use time-units in arithmetic with timestamps, for example:
So you don't need to work out how many second it is.