AutoTools Convert HH:mm to seconds & add time

Discussion in 'AutoApps' started by ShotsFired, Jan 30, 2020.

  1. ShotsFired

    ShotsFired New Member

    Joined:
    Jan 30, 2020
    Messages:
    1
    Likes Received:
    0
    I'm brand new to Tasker and AutoTools, so sorry if I describe things wrong or seem clueless - I am. I'm using the GUI for AutoTools.

    I have %Sunset get set to the time of sunset each day and is displayed as HH:mm, i.e. 17:30. This works. I would like to create another variable, %Sunset60, to be used as a trigger for other Tasks and equal 60 minutes after sunset.

    I am unable to figure out how to convert %Sunset into seconds so I can manipulate it with math (add 3600 for 60 minutes). Here's what I have:

    AutoTools > Time > Time Span

    Convert Time Span: %Sunset
    Use Seconds: True
    Output Variable: set

    %settotalseconds
    Total Seconds

    then as the next Action I have:
    Variable Set %Sunsecs1 to %settotalseconds

    But the output is either 0 or 0.001 or something. I would expect the correct answer to be 63,000 for 17*3600 + 30*60.

    If I could get that working I would then do Variable Set %Sunset60 to %settotalseconds + 3600. But I can't get the conversion of Sunset to seconds working so that part isn't relevant yet.
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,973
    Likes Received:
    759
    Check this out:
    • Create a task
    • add a AutoTools Time action
    • Go to Add Time > Date > Date Millis and set it to 17:30
    • On the same screen set Date Format to HH:mm
    • Go back to the Add Time screen
    • set Add Unit to Hours
    • set Add Value to 1
    • Set Output Format to HH:mm
    • Set Output Variable to added
    • Go back to Tasker and add a Flash action
    • Set the Text to %addeddate
    • Run the task
    • 18:30 should show up
    You can use that value as a trigger in a time condition :)
    Hope this helps!
     

Share This Page