I am making a step-counting app, that resets the steps daily. However, I am unable to define a variable as the date so I can compare the dates and it works fine. Any ideas on how I can do this?
Use milliseconds for each day. Simple subtraction of one value from another, if greater than 86400000ms (a day) then reset)
That's not what I meant, for example, today is April 30, 6 P.M., and I took some amount of steps today and just stopped at 6 P.M. Now if I take 84600000ms as StopDetectionTimeout, then on May 1, at 6 P.M it will start again, which I do not want. I want the pedometer to stop at the next day
identify the day and store it in a variable or TinyDB
and if you find out, that the day changed, then reset your counter
you can find methods to work with date and time in the clock component
https://ai2.appinventor.mit.edu/reference/components/sensors.html#Clock
Taifun
That sadly does not work.
yes, becuase you forgot to set the instant...
what about using the Now method for that?
what about reading the tutorial mentioned earlier?
Taifun
you cannot define a clock.now to a variable on initialisation
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.