Changing yyyyMMdd to dd-MM-yyyy

How do I change the format of the date from yyyyMMdd to dd/MM/yyyy.
Although I can change from MM dd ,yyyy to dd/MM/yyyy, i could not change it from yyyyMMdd to dd/MM/yyyy. Please advice.

Hey @Lim_Jia_An
Could you please explain with an example?
Where are you fetching this date from?

@Lim_Jia_An

First Parse the Date Time String to a dateTime Format

DateTime dt = DateTime.ParseExact(dateString, "yyyyMMdd", 
                                  CultureInfo.InvariantCulture); 

Then You can get the string of required format from a datetime variable
string A = dt.ToString(dd/MM/yyyy)

Regards,
Mahesh

1 Like

Here is a working example -

Main.xaml (5.5 KB)

5 Likes

Thank You!