Answer the question
In order to leave comments, you need to log in
How to get the difference between the current date and time and some date and time in the future or past on arduino?
Good day to all. Please help with the question: how can I calculate the difference between the current date and time value and some arbitrary date and time value.
From iron, there is an Arduino Uno-compatible, RTC DS1302 and an LCD 2004 I2C screen.
Thanks in advance for the suggested thoughts.
Answer the question
In order to leave comments, you need to log in
Implement or find the datetime library. One of the easiest to implement is storing the number of days from a reference date in float format like Pascal/Delphi. Resource intensive, but easy to understand. It is possible as the number of seconds - then you can try to get by with 32-bit integers.
Pitfall: leap years and incremental seconds. I would suggest storing some dates in the form of a table of constants for the intended time range.
There is also a ready one: playground.arduino.cc/Code/DateTime but I don’t know how much memory it will eat.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question