Date/time manipulat...
Clear all

Date/time manipulation in v1.1  


Reputable Member Admin
Joined: 4 years ago
Posts: 287
May 1, 2019 1:32 am  

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 = 1:00:00:00).

Hopefully this sheds some light. Please let us know if you have any questions, issues, or concerns!

new datetime trigger
trigger = "04-30-2019 10:00:00 PM"
print trigger

new time change
change = 1:00:00
new datetime future
future = trigger + change
print future

if future > trigger
print "Yes"
print "Nope"

stop "Test"

Trusted Member
Joined: 2 years ago
Posts: 52
June 16, 2020 12:53 am  

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 = 00:10:00
"Timer" Value = MashStep1_Time

I'd much prefer to read values directly from global variables

"Timer" Value = "00:" + "MashStep1UI_Time" Value + ":00"


Trusted Member
Joined: 2 years ago
Posts: 52
June 16, 2020 3:14 am  

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.

pbruno3 liked
Reputable Member Admin
Joined: 4 years ago
Posts: 287
June 16, 2020 3:25 am  

You figured it out before a response... nice work! Let us know if you need anything else.

Angus liked