Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to display date formate in this formate

18th June 1990


currenlty in this
18 November 1990
formate but i requried 18th "th".

what i change in this format so i can display th in date.

What I have tried:

@Convert.ToString(string.Format("{0:d MMMM yyyy}
Posted
Updated 7-Nov-17 20:30pm
v2

1 solution

refer this datetime - How can i format the date in c# - Stack Overflow[^] to create a new custom date format provider

customize the format to
return string.Format(" {1}{2} {0:MMMM} {0:yyyy}", arg, dt.Day, suffix);

change your code to
@string.Format(new MyCustomDateProvider(), "{0}", item.ValidDate);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900