Forum

Date/time manipulat...
 
Notifications
Clear all

Date/time manipulation in v1.1

4 Posts
2 Users
2 Reactions
5,211 Views
(@pbruno3)
Reputable Member Admin
Joined: 8 years ago
Posts: 343
Topic starter  

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"
else
print "Nope"
endif

stop "Test"

   
Quote
(@angus_grant)
Trusted Member
Joined: 6 years ago
Posts: 52
 

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"

Thanks,
Angus.


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 6 years ago
Posts: 52
 

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 reacted
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 8 years ago
Posts: 343
Topic starter  

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


   
Angus reacted
ReplyQuote
Share: