Execute script between defined time frame.
Im struggling with time functions. What I want to achieve is to have a script that will be execute at random times by a user, but I need a check inside the code to make sure that it can only be invoked between a certain time of the day. Lets say someone runs it at 8am and the time span in the script is from 6am to 10am, then the script must run as normal. Any other time outside this window should exit the script with a message. I know I should put the current execution time in a variable and then compare bewteen the lower and upper time variables to determine whether the current time it between these times, but Im not sure how to do that. Im not worried about date, just time. Any halp will be appretiated.