TestProject Forum

Need to Increment Date value from the given Input Date to an incremental number of days

Hi @kfir.yosef , Thanks for your help for my earlier issues.

Now i have come across a requirement to increment Date value with a given ‘StartDate’ as input data and from there on i will need to pass some random number of days to increment the Date via a parameter it can be any random incremental number like 3, 7, 8, 5 , 16, 30 and so on.
Based on the Date of the month the value need to be incremental Date with the given parameter values.
Example: If i give date 10/29/2021 and increment value 5 then the output date need to be 11/03/2021
If i give date 12/25/2021 and increment value 8 then the output date need to be 12/02/2022

I tried with Action ‘Set days of a DateTime object’ with My date format as mm/dd/yy, i have input date value as 10/31/21 now i want to add 6 days to 10/31/21 so i get new date as 11/05/21

I am using below function to do so but my new date i am getting is 10/05/21, month value is not getting changed here. I am expecting date value to be changed as 11/05/21


Thanks,

Hi @sahanijuttukon,
Please try to update the addon and check again,
As explained here:

It should work as expected.

Hi @Amit.Lacher I tried again but i am still not getting correct value with this action


image

Hey @sahanijuttukon ,
You need to use the correct date format: MM/dd/yyyy
Note that the M is capital.

Hi @Amit.Lacher It worked with Capital ‘M’ but how would we know where to use capital and where to use non capitals in format.

Thanks,

In your case, you used m for minutes and not M for Months.
You can find more information on the representation here:

https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html

Symbol  Meaning                      Presentation  Examples
 ------  -------                      ------------  -------
 G       era                          text          AD
 C       century of era (>=0)         number        20
 Y       year of era (>=0)            year          1996

 x       weekyear                     year          1996
 w       week of weekyear             number        27
 e       day of week                  number        2
 E       day of week                  text          Tuesday; Tue

 y       year                         year          1996
 D       day of year                  number        189
 M       month of year                month         July; Jul; 07
 d       day of month                 number        10

 a       halfday of day               text          PM
 K       hour of halfday (0~11)       number        0
 h       clockhour of halfday (1~12)  number        12

 H       hour of day (0~23)           number        0
 k       clockhour of day (1~24)      number        24
 m       minute of hour               number        30
 s       second of minute             number        55
 S       fraction of second           millis        978

 z       time zone                    text          Pacific Standard Time; PST
 Z       time zone offset/id          zone          -0800; -08:00; America/Los_Angeles
"
 '       escape for text              delimiter
 ''      single quote                 literal       '