# Calculation Number of Days Between Two Dates

Topic:

## Delphi Language

1. charlene44 wrote: 18/08/2006 at 15h08

## calculation of number of days between two dates

1. Good morning
2. 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.
3. Ben_Le_Cool wrote: 18/08/2006 at 3:13pm

1. Hi,
2. You can use the DaysBetween feature. That gives you the number of whole days between two TDateTimes.
3. function DaysBetween(const ANow, AThen: TDateTime): Integer;
4. e-ric wrote: 18/08/2006 at 15:22 pm

1. The previous answer is valid if you manipulate the dates in the Delphi code as TDateTime from Delphi 6 onwards otherwise
2. 1

2

3

4

5

3. charlene44 wrote: 19/08/2006 at 02:11am

1. thank you very much, I’ll try that!
2. edam wrote: 19/08/2006 at 02:24am

1. Sent by e-ric

2. 1

2

3

4

5

3. charlene44 wrote: 19/08/2006 at 02:36am

1. 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
2. edam wrote: 19/08/2006 at 02:49am

1. 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
2. mafuku wrote: 21/08/2012 at 3:06pm

## Difference between two dates

1. 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.
2. 1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

## How to Create a New User on Ubuntu 20.04 – Linux Tip

Like all main working programs, Linux is a multi-user working system that lets customers to have their very…

## S02e01 From the Perfection of Fullmetal Alchemist: Brotherhood

With its great character gallery, great script, great universe, great drawing, great action and great humor, you’ll probably…

## [test] far cry patch New Dawn: a Dj-vu Re

On paper, far cry patch New Dawn looks like a bad joke from 2008. That year, Ubisoft decided…

## The Renewal of Monster’s Charm

Each enjoyed Elizabeth. The enthusiastic as well as practically reverential accessory with which all concerned her came to…