robhunter Posted July 13, 2011 Share Posted July 13, 2011 Hello, I need to set the @HOUR parameter to my actual computer time -1 (so at 23:00 it's 22:00) but I have a problem, when it is 00:00 it says it's -1:00... How can set this option? Thanks in advice Link to comment Share on other sites More sharing options...
timbo Posted July 14, 2011 Share Posted July 14, 2011 Hi there, Try this: Local $time=@HOUR-1 If $time<0 Then $time=23 ConsoleWrite("Time: "&$time&@CRLF) Or If @HOUR=0 Then ConsoleWrite("Time: 23"&@CRLF) Else ConsoleWrite("Time: "&(@HOUR-1)&@CRLF) EndIf Hope that works for you. -Timbo Link to comment Share on other sites More sharing options...
smartee Posted July 14, 2011 Share Posted July 14, 2011 Or simply $iHour = Mod((@HOUR + 23), 24) Link to comment Share on other sites More sharing options...
timbo Posted July 14, 2011 Share Posted July 14, 2011 Or simply $iHour = Mod((@HOUR + 23), 24) I like it! I've been using my way (subtracting hours, minutes, seconds) for years thinking that there had to be a better way (without using "_date" functions), now I know... -Timbo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now