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

SDATE Function

  Sdate   Windows   Relative Date   Date

The start date with 31 as last day

That maintain the last day of month when a day is 31. That also respect leap years.

Scenario Outline

Given the date <start date>
When relative delta <relative delta> is applied
Then the relative date should be <relative date>

Examples: 

# Description Start Date Relative Delta Relative Date
1 next month 2021-01-31 months=+1 2021-02-28
2 last month 2021-01-31 months=-1 2020-12-31
3 next two months 2021-01-31 months=+2 2021-03-31
4 next three months 2021-01-31 months=+3 2021-04-30
5 next month, plus one week 2021-01-31 months=+1, weeks=+1 2021-03-07
6 one month before one year 2021-01-31 years=+1, months=-1 2021-12-31
7 one month after one year 2021-01-31 years=+1, months=+1 2022-02-28
8 one month after three year (2024 leap year!) 2021-01-31 years=+3, months=+1 2024-02-29
9 next ten days 2021-01-31 days=+10 2021-02-10
10 next friday 2021-01-31 weekday=FR 2021-02-05
11 last friday in this month 2021-01-31 weekday=FR(-1) 2021-01-29
Steps Outcome
SUCCESS 014ms
SUCCESS 016ms
SUCCESS 015ms
SUCCESS 015ms
SUCCESS 017ms
SUCCESS 018ms
SUCCESS 017ms
SUCCESS 016ms
SUCCESS 016ms
SUCCESS 015ms
SUCCESS 016ms
SUCCESS 0.22s
Serenity BDD version 3.6.22