Financial Risk Management
Home
>
Date And Time
>
Relative date time
>
SDATE Function
> The start date with 31 as last day
Overall Test Results
Requirements
Themes
Capabilities
Features
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
1: The start date with 31 as last day ({description=next month, start date=2021-01-31, relative delta=months=+1, relative date=2021-02-28})
SUCCESS
014ms
Given the date 2021-01-31
SUCCESS
001ms
When relative delta months=+1 is applied
SUCCESS
Then the relative date should be 2021-02-28
SUCCESS
006ms
2: The start date with 31 as last day ({description=last month, start date=2021-01-31, relative delta=months=-1, relative date=2020-12-31})
SUCCESS
016ms
Given the date 2021-01-31
SUCCESS
When relative delta months=-1 is applied
SUCCESS
Then the relative date should be 2020-12-31
SUCCESS
007ms
3: The start date with 31 as last day ({description=next two months, start date=2021-01-31, relative delta=months=+2, relative date=2021-03-31})
SUCCESS
015ms
Given the date 2021-01-31
SUCCESS
001ms
When relative delta months=+2 is applied
SUCCESS
001ms
Then the relative date should be 2021-03-31
SUCCESS
008ms
4: The start date with 31 as last day ({description=next three months, start date=2021-01-31, relative delta=months=+3, relative date=2021-04-30})
SUCCESS
015ms
Given the date 2021-01-31
SUCCESS
When relative delta months=+3 is applied
SUCCESS
001ms
Then the relative date should be 2021-04-30
SUCCESS
007ms
5: The start date with 31 as last day ({description=next month, plus one week, start date=2021-01-31, relative delta=months=+1, weeks=+1, relative date=2021-03-07})
SUCCESS
017ms
Given the date 2021-01-31
SUCCESS
001ms
When relative delta months=+1, weeks=+1 is applied
SUCCESS
001ms
Then the relative date should be 2021-03-07
SUCCESS
008ms
6: The start date with 31 as last day ({description=one month before one year, start date=2021-01-31, relative delta=years=+1, months=-1, relative date=2021-12-31})
SUCCESS
018ms
Given the date 2021-01-31
SUCCESS
004ms
When relative delta years=+1, months=-1 is applied
SUCCESS
Then the relative date should be 2021-12-31
SUCCESS
005ms
7: The start date with 31 as last day ({description=one month after one year, start date=2021-01-31, relative delta=years=+1, months=+1, relative date=2022-02-28})
SUCCESS
017ms
Given the date 2021-01-31
SUCCESS
002ms
When relative delta years=+1, months=+1 is applied
SUCCESS
Then the relative date should be 2022-02-28
SUCCESS
007ms
8: The start date with 31 as last day ({description=one month after three year (2024 leap year!), start date=2021-01-31, relative delta=years=+3, months=+1, relative date=2024-02-29})
SUCCESS
016ms
Given the date 2021-01-31
SUCCESS
002ms
When relative delta years=+3, months=+1 is applied
SUCCESS
001ms
Then the relative date should be 2024-02-29
SUCCESS
008ms
9: The start date with 31 as last day ({description=next ten days, start date=2021-01-31, relative delta=days=+10, relative date=2021-02-10})
SUCCESS
016ms
Given the date 2021-01-31
SUCCESS
When relative delta days=+10 is applied
SUCCESS
001ms
Then the relative date should be 2021-02-10
SUCCESS
008ms
10: The start date with 31 as last day ({description=next friday, start date=2021-01-31, relative delta=weekday=FR, relative date=2021-02-05})
SUCCESS
015ms
Given the date 2021-01-31
SUCCESS
003ms
When relative delta weekday=FR is applied
SUCCESS
Then the relative date should be 2021-02-05
SUCCESS
006ms
11: The start date with 31 as last day ({description=last friday in this month, start date=2021-01-31, relative delta=weekday=FR(-1), relative date=2021-01-29})
SUCCESS
016ms
Given the date 2021-01-31
SUCCESS
001ms
When relative delta weekday=FR(-1) is applied
SUCCESS
Then the relative date should be 2021-01-29
SUCCESS
006ms
SUCCESS
0.22s
Serenity BDD version 3.6.22