Calculate the days between dates using the DatePicker and Clock components

3,867 views
Skip to first unread message
Assigned to emrahm...@gmail.com by me

Scott Ferguson

unread,
Feb 9, 2015, 6:34:19 AM2/9/15
to app-inventor-de...@googlegroups.com
THIS VERSION HAS BEEN REPLACED BY 'Days between dates using new blocks'

This project was inspired by a support request on my Facebook App Inventor Projects page.
It calculates the fractional number of days between two dates using two DatePickers and a Clock component.

returns a fractional day from two date inputs formatted as MM/DD/YYYY

Explanation:

Use the number of milliseconds between dates to calculate the number of days between the dates by using dimensional analysis to convert ms to days (ignores leap seconds):

ms x 1 sec    x 1 hr        1 day 
     -----      ----     x  -----
     1000 ms    3600 sec    24 hr 

So: ms/86400000 = fractional days

aia project is attached.


See also this simple example of calculating days between dates for AI Classic > here <

It could be easily rewritten for the current AI version. Will you be the one to do it?

---

sf


daysbetweendates.aia

sapan kotak

unread,
Jun 14, 2019, 3:03:20 PM6/14/19
to App Inventor Developers Library
how can I change date formate from MM/DD/YYYY to DD/MM/YYYY for the same operation?
Reply all
Reply to author
Forward
0 new messages