How to add years to a date in 'yyyy' format

Hi Everyone,

My requirement is i need a years to a date which is in given format

there is an excel with dates eg: 14-December-2019, 12-Dec-2019, 12-Dec-19 , 2019
i am just using certain dateformats in array like[dd-MMM-yyyy, d-MMM-yy, yyyy]etc
first i check whether its its in date and parse them using tryparseextract
and in next column of excel i have number eg:1.0 ,2.5 etc
which i have to add to current date

EstDate = Cdate(row(datecolumn)).addYears(cint(number))

problem is i am getting for dates in yyyy format stating conversion from double to type date is not valid

Please help @Palaniyappan

Thanks in advance

1 Like


When it comes to multiple date array format try by passing array of date formats in Datetime ParseExact method

Refer this thread for more details on using array of date formats

Cheers @kavya.s16