Start script if not between two times

Started by MW4, December 20, 2017, 09:31:55 AM

Previous topic - Next topic

MW4

I need to set up a basic if statement that only proceeds if the current time is not between Midnight and 5:20 am.
I'm hung up on syntax

Here's what I'm attempting:

If TimeYmdHms ( ) > 00:01:00 and < 05:20:00
   Quit
Endif

Run Script

Is it two time differentials?

td

Many ways to do this.  Here is but one:

Code (winbatch) Select
TimeCurrent = TimeYmdHms()
HMSCurrent  = ItemExtract(4,TimeCurrent,':'):ItemExtract(5,TimeCurrent,':'):ItemExtract(6,TimeCurrent,':')
if HMSCurrent > 235959 && HMSCurrent < 52100 then exit


I sure there better approaches.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

MW4

that's it, it's been a long while since I used time code.

Thanks!

MW4


td

The time values in the example are being used as integers and not strings so a leading zero (0) does not make any difference.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

MW4