volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

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.

#150221
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) 

#150223
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.