How to add specific date from a variable + 6 days?

Hi guys! If I have a specific date like 11/04/2019 and how to add 6 more days so how should I get this date: 17/04/2019?

Thanks!

Hi @phoenix123 you can do like this

out_date = DateTime.ParseExact(“11/04/2019”,“dd/MM/yyyy”,system.globalization.CultureInfo.InvariantCulture).Adddays(+6)

where out_date is of type datetime

to get this as string do like
DateTime.ParseExact(“11/04/2019”,“dd/MM/yyyy”,system.globalization.CultureInfo.InvariantCulture).Adddays(+6).ToString

2 Likes

Is that working buddy @phoenix123

@Palaniyappan hey buddy I am still working on it around 5 mins let u know again? :slight_smile:

1 Like

@Palaniyappan hey buddy if my date like 11/04/2019 is store in a variable, will it still work?

Yes @phoenix123 if is stored in variable mention like this
DateTime.ParseExact(datetimevariable.ToString,“dd/MM/yyyy”,system.globalization.CultureInfo.InvariantCulture).Adddays(+6)

1 Like

not able to see any image @phoenix123

@Palaniyappan

hey buddy I have installed the system.globalization but I don’t why suddenly got this error

the datetwo is in generic type change it to datetime type in variable panel

1 Like

@Palaniyappan system.datetime you mean?

yes buddy

1 Like

@Palaniyappan hey buddy thanks for your fast response but I will try running the sequence then I will let you is success or not.

2 Likes

Yah sure. @phoenix123 …waiting

Cheers

2 Likes

@Palaniyappan hey buddy yes is adding the date correctly but how come I get 04/17/2019 and 00:00:…? can we filter away?

1 Like

I didn’t get you can
you come again elaborately

1 Like

Hi,

Adding to what @Palaniyappan said, datevalue.toshortdatestring.

This will give you only the date excluding the time hh:mm:ss

Let us know if this helps,
Regards,
Pavan H

2 Likes

This is how it is @phoenix123

Convert.ToDatetime(DateTime.ParseExact(datetimevariable. ToString ,“dd/MM/yyyy”,system.globalization.CultureInfo.InvariantCulture).Adddays(+6).ToString)

2 Likes

does that work buddy

@Palaniyappan I realized the mistake I made yup the previous solution is correct my bad and really thanks for your help again! @pavanh003 thank you sir for your suggestion! :slight_smile:

1 Like

Cheers
Keep going

1 Like