Microsoft Dynamics 365 Blog

We got this from a Microsoft Dynamics CRM user the other day:

1. Is it possible to get long date formatting instead of short date on DateTime values on the crm form (and views), i.e. I am looking to display ‘‘Monday 2010-03-29‘‘ instead of just ‘‘2010-03-29‘‘?

2. When selecting date format values in options – settings on the user profile there is a fixed set of alternatives for English. For Swedish they are even fewer. Is this information hard coded or read from cultureinfo in the base library dlls.

What I am looking to achieve in this specific case is Swedish formatting and long dates (with day of week displayed) on all forms and views.

Here’s my response:

For forms and grids, we always use the Short Date user setting, so the only way to accomplish your desired behavior was if “dddd yyyy-MM-dd” was one of the Short Date options for your locale. For your second question, we pull the list of available Short Date and Long Date formats from the .NET Framework. There is some additional processing, but the root of the code which gets the Short Date options does something like this:

    string[] formats = CultureInfo.GetCultureInfo("sv-SE").DateTimeFormat.GetAllDateTimePatterns(‘d’);

We use the .NET formatting engine to format all of our dates and numbers, and it’s flexible enough that even though the Swedish (Sweden) locale might not have a Short Date option of “dddd yyyy-MM-dd”, it doesn’t meant that we couldn’t render dates in that format across the application. We just chose to only use the date\time patterns belonging to each locale as given to us by the .NET Framework so that we didn’t have to get in the business of mapping locales to patterns ourselves.

Remember, we have a lot of people answering questions on the Dynamics CRM Forums too.

Cheers,

Tyler Peelen


We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!