If the input is 06/01/2016 the output should be 6/1/2016
06/12/2016-output should be 6/12/2016
12/01/2026 output:12/1/2026
12/11/2016:12/11/2016
Hi @sruthesanju,
You can use the code below:
Datetime.ParseExact(myinput,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString("d/M/yyyy")
Basically we’re parsing the input with the date format “dd/MM/yyyy” and writing as “d/M/yyyy”
I am getting the below error
The datrtime represent by string is not supported in calendar system.globalization.gregoriancalendar
Hi @sruthesanju ,
Try it as CDate(datevariable).ToString(“d/M/yyyy”)
or
DateTime.Parse(datevariable).ToString(“d/M/yyyy”)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.