Change date variable "MM/dd/yyyy" to date variable "dd/MM/yyyy"

I have a variable in the type of date and in the format “MM/dd/yyyy” and I want to turn it to the format as “dd/MM/yyyy”. I’m getting an error because the variable type is not string, could you help pls…

HI @ozhazdayt

What is the variable type of the input string?

You can try with this expression

DateTime.ParseExact(StringInput.ToString,"MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Regards
Gokul

You can try with CDate syntax

CDate(YourDateTimeVariable).ToString("dd/MM/yyyy")

image

Regards
Gokul

The type of variable to change is not string, its type is date. Therefore, this expression gives error

Have you tried with this? @ozhazdayt

Adding one more paranthesis is solved my problem, thanks

Great @ozhazdayt Kindly close this topic by mark as solved. it would help for other too.

Regards
Gokul

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