Date/time manipulation in v1.1
I received a couple of questions about date/time manipulation, so wanted to post up a sample that may shed some light. In this "Test" script example, we define a date/time variable named 'trigger', assign it to a date/time, then print it (to the Output tab). We then define a time variable 'change', and make it one hour. We then define another date/time, and add the 'change' time variable to it, then print it. Finally, we compare the two date/time variables and generate a print out as a result (will always resolve to "Yes" here).
If you wanted to do a comparison to the current time, use the intrinsic 'now' variable (for example: trigger = now). Also, if you wanted to add days rather than hours, you can include days in the time variable (for example: change = 100).
Hopefully this sheds some light. Please let us know if you have any questions, issues, or concerns!
new datetime trigger
trigger = "04-30-2019 1000 PM"
new time change
change = 100
new datetime future
future = trigger + change
if future > trigger
yeh, necro post.
Is it possible to manipulate a time variable with a global value? ideally I want a set of global variables to hold mash temps and times.
I then use those values in script to control my mash programme.
Currently I have a bunch of variables to hold mash step time, and use that variable to control timer. But it would certainly be nicer to use the UI to define those values.
Current script excerpt below:
new time MashStep1_Time
MashStep1_Time = 0000
"Timer" Value = MashStep1_Time
I'd much prefer to read values directly from global variables
"Timer" Value = "00:" + "MashStep1UI_Time" Value + ":00"
So I found a snippet from RiverCtyBrewer in HBT about setting global variable to time type (I was using value and recording minutes as integer), and entering in full time that way.
"Timer" Value = "MashStep1_Time" Value
Sorted. I knew it would be something simple.
You figured it out before a response... nice work! Let us know if you need anything else.