Remove Leading Zeros from dates


I have a variable that is a date with the current formatting of 07/07/2023. I need to reformat this date to read 7/7/2023. Thank you!

Hi @peterrb

Try this

DateTime.ParseExact(InputDate, "MM/dd/yyyy", CultureInfo.InvariantCulture).ToString("d/M/yyyy")

I hope it helps!!

Hi @peterrb

Use the below expression

reformattedDate = DateTime.ParseExact(yourDateVariable, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("M/d/yyyy")

Hope it helps!!

Try this
i have attached xaml along with the solution
DateTime.ParseExact(originalDate, “MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“M/d/yyyy”) (2.4 KB)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.