Dawid

unread,
Mar 27, 2019, 6:17:58 PM3/27/19
to MIT App Inventor Forum

Hi guys,

I want to calculate difference (numer of days) between two dates - the date set in DatePicker and the Current Date.
Below you can see the blocks I use to set dates:

Current Date

Picked Date

I tried to use simple equation: ShowSelectedDate - ShowCurrentDate, but... :(

Can anyone help?

Thanks, Dawid

TimAI2

unread,
Mar 27, 2019, 7:17:42 PM3/27/19
to MIT App Inventor Forum
Many ways to do this, I like to convert to milliseconds to do the calculation
You will need to add a clock component (in Sensors) for the additional blocks

blocksdatediff.png


Ghica

unread,
Mar 28, 2019, 8:30:55 AM3/28/19
to MIT App Inventor Forum
Be careful, your timezone may get in the way if your difference is close to your timezone difference.
Cheers, Ghica.
Reply all
Reply to author
Forward
0 new messages