Hi there,
i am currently working on .Net application which is using Optimizely to render the website. At the moment the date picker that is being used returns a 0 when selecting a day which has a single digit:
The code which formats the date can be found below:
I have tried returning the string as ("d\"" + suffix + "\" MMM") but this never worked. Does anyone here have any sugestions on how i can make this work?
Thanks
i am currently working on .Net application which is using Optimizely to render the website. At the moment the date picker that is being used returns a 0 when selecting a day which has a single digit:
The code which formats the date can be found below:
C#:
public static string FormatDay(this DateTime date)
{
string suffix = date.Day switch
{
1 or 21 or 31 => "st",
2 or 22 => "nd",
3 or 23 => "rd",
_ => "th",
};
return date.ToString("dd\"" + suffix + "\" MMM");
}
I have tried returning the string as ("d\"" + suffix + "\" MMM") but this never worked. Does anyone here have any sugestions on how i can make this work?
Thanks