2

the title says is all I want to create a task that holds a count from a certain date My goal is then to use minimal text to display the amount of days, that part I know how to do it's just getting Tasker to do the sums Any ideas?

1 Answer 1

4

You first have to convert both dates to seconds using Variable Convert. Then subtract those two values to get the number of seconds between the two dates and convert that value to the number of days by /24/60/60 (hours/minutes/seconds).

Here is a sample task that illustrates using 08-01-2014 as %startdate and today (%DATE) which is 08-23-2014 as %today. The result is 22 days.

A1: Variable Set [ Name:%startdate To:08-01-2014 Do Maths:Off Append:Off ]

A2: Variable Convert [ Name:%startdate Function:Date Time to Seconds Store Result In:%startdateinseconds ]

A3: Variable Set [ Name:%today To:%DATE Do Maths:Off Append:Off ]

A4: Variable Convert [ Name:%today Function:Date Time to Seconds Store Result In:%todayinseconds ]

A5: Variable Set [ Name:%secondssince To:%todayinseconds - %startdateinseconds Do Maths:On Append:Off ]

A6: Variable Set [ Name:%dayssince To:%secondssince / 24 / 60 / 60 Do Maths:On Append:Off ]

You could shorten this a bit by eliminating A3 and replacing %today with %DATE in A4. Also, you could combine A5 and A6 by using (%todayinseconds - %startdateinseconds) / 24 / 60 / 60. I split it up only to show the individual steps better.

2
  • Thanks for the reply! I ended up just figuring out the days and then adding 1 to it each day, but I will try this out for future reference!
    – Sjharrison
    Aug 24, 2014 at 10:47
  • No problem. I hope it helps you.
    – Wyzard
    Aug 31, 2014 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .