- I have a small problem: I have dates stored in my database in date format, and with two dates I would like to find the number of days between them, so get an integer, how can I calculate that? thank you in advance.
- Ben_Le_Cool wrote: 18/08/2006 at 3:13pm
- You can use the DaysBetween feature. That gives you the number of whole days between two TDateTimes.
- function DaysBetween(const ANow, AThen: TDateTime): Integer;
- e-ric wrote: 18/08/2006 at 15:22 pm
The previous answer is valid if you manipulate the dates in the Delphi code as TDateTime from Delphi 6 onwards otherwise
- charlene44 wrote: 19/08/2006 at 02:11am
ba it works anyway, thank you very much, it gives this, I made an example very quickly to test, it’s not at all optimized but it’s okay, it gives : this
- edam wrote: 19/08/2006 at 02:49am
on the contrary this code given by eric that I prefer, and even sometimes I change all the dates and hours in integrate to facilitate the calculation
- mafuku wrote: 21/08/2012 at 3:06pm
The example is made with two TDatetimePicker components that send their values to the variables p1 and p2. Just an addition to what already exists.