Home > Date And Time > Relative date time > DATEDIF Function > The start date with 31 as last day
Report generated 11-04-2023 10:42

DATEDIF Function

  Datedif   Windows   Relative Delta   Date

The start date with 31 as last day

That never cross the month boundary of the end date when handling months delta with different numbers of days.

Scenario Outline

Given the first date <start date> and the second date <end date>
When the datedif function is used to compute the difference between them
Then the returned relative delta should be <relative delta>

Examples: 

# Start Date End Date Relative Delta
1 2021-01-31 2021-02-28 months=1
2 2021-01-30 2021-02-28 months=1
3 2021-01-29 2021-02-28 months=1
4 2021-01-28 2021-02-28 months=1
5 2021-01-27 2021-02-28 months=1, days=1
6 2021-01-26 2021-02-28 months=1, days=2
7 2021-01-31 2020-12-31 months=-1
8 2021-01-31 2021-03-31 months=2
9 2021-01-31 2021-04-30 months=3
10 2021-01-31 2021-03-07 months=1, days=7
11 2021-01-31 2021-12-31 months=11
12 2021-01-31 2022-02-28 years=1, months=1
13 2021-01-31 2024-02-29 years=3, months=1
14 2021-01-31 2021-02-10 days=10
Steps Outcome
SUCCESS 022ms
SUCCESS 026ms
SUCCESS 029ms
SUCCESS 023ms
SUCCESS 027ms
SUCCESS 031ms
SUCCESS 036ms
SUCCESS 023ms
SUCCESS 031ms
SUCCESS 028ms
SUCCESS 027ms
SUCCESS 024ms
SUCCESS 029ms
SUCCESS 030ms
SUCCESS 0.47s
Serenity BDD version 3.6.22