Add one year to string


I have a string 01.01.2019 and I need to add here one year. I cannot convert this string to date and then add :frowning: Thanks for help

Hi @Marek_Matuszak, kindly check this code to add one year to given date in string

given_date = "01.01.2019"
 next_date = DateTime.ParseExact(given_date, "", System.Globalization.CultureInfo.InvariantCulture).AddYears(1).ToString("") 

Output is : image

Hope it helps you

Mark it as solution if you got it

Nived N
Happy Automation

Hi @Marek_Matuszak,

Simplest thing you can do is :
String = “01.01.2019”


1 Like