06-27-2017 04:39 PM
I have a VI I have written to check the status within a database. I have it so that it sends out an email if the status is true. I want to check the status just after midnight and fire off the email. I only want it to fire off the single event, and then reset so that it does the same thing every night just after midnight. I can not figure out how I can check the time and if it is true fire off the event. I have searched the forums and the internet to see if someone has done this, but I have found nothing. Is there a way to do this? Any help is greatly appreciated.
Dave
Solved! Go to Solution.
06-27-2017 04:51 PM
Hi Dave,
I can think of a few ways this could be done. The most accurate might be to use the Get Date/Time In Seconds function and use LabVIEW's version of the modulus function to determine when midnight occurs. Alternatively, you could use a timer that measures 24 hour periods and executes every time the timer goes off. You'll still need to use the Get Date/Time In Seconds with a shift register though. Check out some FGV Timer examples if you are unfamiliar with the architecture. Also, you would probably have to start this timer manually at the time you want it to go off.
There are numerous other ways to do this, but the first option I have listed is how I would do it off the top of my head.
Best,
Duncan W.
06-28-2017 10:51 AM - edited 06-28-2017 10:54 AM
The easiest solution I've ever found to this was to look at the day, and in a shift register or feedback node, compare it to the previous value for day, and if it is not equal, then do your event. If it is equal (then midnight hasn't passed) and you should not trigger the event. If you move time zones this will effect it, but if daylight savings occurs it will still happen since that is at 2AM.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-28-2017 12:00 PM
Thank you for your replies and for the example. It seems pretty straight forward and simple. I knew there must be a simple solution, I was just over thinking the whole thing!!
Thanks,
Dave
06-28-2017 01:07 PM
@Hooovahh wrote:
If you move time zones this will effect it,
Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running. Only after you exit and restart LabVIEW will it detect the new time zone.
06-28-2017 01:23 PM
@RavensFan wrote:
Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running. Only after you exit and restart LabVIEW will it detect the new time zone.
Oh interesting point, so I guess in this situation it should be fine. I was more or less thinking of the situation where you ship a piece of equipment into a new timezone, and things are shifted, but then again if you ship the thing there's a pretty good chance it won't be setup at midnight the next day anyway. This is a bigger issue when logging data in one timezone, and sending the files to another (assuming no standard like UTC is used)
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-11-2017 01:07 PM
@Hooovahh wrote:
@RavensFan wrote:
Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running. Only after you exit and restart LabVIEW will it detect the new time zone.
Oh interesting point, so I guess in this situation it should be fine. I was more or less thinking of the situation where you ship a piece of equipment into a new timezone, and things are shifted, but then again if you ship the thing there's a pretty good chance it won't be setup at midnight the next day anyway. This is a bigger issue when logging data in one timezone, and sending the files to another (assuming no standard like UTC is used)
Just saw this thread. "%^<%I:%M:%S %p>T" See that carret? That is really nice to have in the display format for timestamp controls and constants you ship to other areas.
Somtimes Ill even do this