I have variable start date as string = 27/06/2021
If I want to -1 date from 27/06/2021
output : 26/06/2021 (string)
Please guide me about it.
I have variable start date as string = 27/06/2021
If I want to -1 date from 27/06/2021
output : 26/06/2021 (string)
Please guide me about it.
first Convert that string to datetime format:
Dt_date= DateTime.ParseExact(“27/06/2021”,“dd/MM/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)
out_date = Dt_Date.AddDays(-1).ToString(“dd/MM/yyyy”)
this will give you -1 day
Hi @fairymemay
Please try this also,
Cdate(yourvariable).AddDays(-1).Tostring(“dd/MM/yyyy”)
or
Convert.ToDateTime(yourvariable).AddDays(-1).Tostring(“dd/MM/yyyy”)
Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.