---
url: /flow/guide/scripting-reference/functions/datetime/daysbetween.md
---

# DaysBetween

## Declaration

`function DaysBetween(const ANow: TDateTime; const AThen: TDateTime): Integer;`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := DaysBetween(Date, Date+4); //returns 4 being the days between the two dates
end;
```

## Description

Returns the number of days between two dates. The ordering of the two dates doesn't matter - the number of days will not be negative.

DaysBetween counts only whole days. Thus, DaysBetween reports the difference between Dec 31, 1999 11:59 PM and Jan 1, 2000 11:58 PM as 0 because the difference is one minute short of an entire day.
