Changing yyyyMMdd to dd-MM-yyyy


#1

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.


#2

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


#4

@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


#5

Here is a working example -

Main.xaml (5.5 KB)


#7

Thank You!