How Do I Change a Date Format?
I have a date variable in the format “MM/dd/yyyy” but I want to change it to “dd/MM/yyyy.” It keeps giving me an error because it’s not a string.
I’m super confused—can anyone help me figure this out
How Do I Change a Date Format?
I have a date variable in the format “MM/dd/yyyy” but I want to change it to “dd/MM/yyyy.” It keeps giving me an error because it’s not a string.
I’m super confused—can anyone help me figure this out
Hi,
Can you try as the following?
CDate(strVariable).ToString("dd/MM/yyyy")
Regards,
Try this way,
Str variable = DateTime.ParseExact("Yourinput",{"MM/dd/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy")
If you have more input format means you can add in the array
Regards,
Gowtham K
To change the date format, you can use this code:
CDate(YourDateTimeVariable).ToString(“dd/MM/yyyy”)
This will convert your DateTime variable to the desired format.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.