not able to convert variable into date time and add days
(Convert.ToDateTime(pdf_date.ToString))
Cannot evaluate ‘(Convert.ToDateTime(pdf_date.ToString))’ at current context.
I tried to check the value of pdf_date and pdf_date.ToString in immediate window
it coming
but conversion throws error
pdf_date is “16.5.2021”
also after that I need to add days
(Convert.ToDateTime(pdf_date.ToString)).AddDays(Cint(Regex.Split(var2,“-”)(1))*7).ToShortDateString ---- this gives the error as
Assign: String was not recognized as a valid DateTime.
Convert.ToDateTime is expecting input in US format i.e., MM.dd.yyy format. So it works for 5.16.2021. It doesn’t work for 16.5.2021 because month value cannot be greater than 12
so shall I first convert into US format ??
(pdf_date.ToString).ToShortDateString(“MM/dd/yyyy”) doesnt work
and this also doesnt work
Datetime.ParseExact(Convert.ToDateTime(PDF_date),“MM.dd.yyyy”,System.Globalization.CultureInfo.InvariantCulture)
But Cdate is also not working
the same work when date is like US format like MM.dd.yyyy
but actually date is in dd.MM.yyyy format , so when date value to larger than 12 or max month then it throws error