SaaS CMS has officially launched! Learn more now.

format date per culture


Is there any inbuilt functionality in episerver to format the dates according to culture? e.g. 3rd of May (English), 3 de enero (Spanish) etc. Thank you.

Jun 14, 2016 10:25

Nope. Use standard .NET string.Format for that. Since the current thread will be set to the same culture as the current page it will work great. 

If you have a property with date, use the standard Html.PropertyFor() to render it. If you are unhappy with the format, add a new display template and matching UIHint on property to make a custom display template (using the .NET string.Format() to output the date in the display template) 

Edited, Jun 14, 2016 10:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.