Question Status

Adam747 asked a question on 30 Apr 2014 5:03 AM

We use CRM 2013 On-Premises (Rollup 2, UR2) in the UK with DB language British English and have had a problem with the created, modified date that is displayed at the bottom of each note since upgrading from CRM 2011.

The note dates all say 'Today' with the correct time, and if the date is less than the 5th of the month then 'a' date is shown except its got the month and day mixed up, e.g. its read a UK date from the DB and switched it to a USA date somewhere, 04/01/2014 shows as 1st April 2014... Wrong!! this is the UK, and when it finds a DB date '05/01/2014' it just shows 'Today' thus the application must be erroring trying to convert a UK date to USA.

Please can MS fix this BUG already!!

Kristinaxyz responded on 21 May 2014 4:54 PM

This issue is driving me crazy, too. We need the date on the case note in Australian format.

Does anyone have a fix or, at least, a workaround besides manually entering the date in each case note?

Chris Grubb responded on 3 Jun 2014 7:03 PM

Just adding another voice (also Australian) who is experiencing this issue :(

Bin responded on 10 Jun 2014 4:01 PM

you can update the notesv2.js(for service pack 1) or notes.js(before service pack 1) under Program Files\Microsoft Dynamics CRM\CRMWeb\_static\_forms

for notesv2.js, update the following code to swap the date and month because the new date() function only takes US format date string:

$v_0.set_createdOn(new Date(annotationUI.CreatedOn.toString()));

$v_0.modifiedOn = (new Date(annotationUI.ModifiedOn.toString()));

after clear your browser cache, you should be able to see the correct date, but this is UNSUPPORTED by MS.

Adam747 responded on 11 Jun 2014 12:25 AM

Thanks for the suggested answer, I have located the references that you've advised and wondered if you could suggest how to swap the day and month around within the JavaScript file.

I'm not sure what format the inputs (annotationUI.CreatedOn.toString()) are long,short or other format and so manipulating the string would be difficult and prone to problems.

Please can advise on what the solution should look like?

Bin responded on 11 Jun 2014 2:17 PM

The format of annotationUI.CreatedOn.toString() looks like this 15/05/2012 1:10:19 p.m. for example.

so we can use following JS code to swap the day and month for CreatedOn:

var createdOnParts=annotationUI.CreatedOn.toString().split('/');

$v_0.set_createdOn(new Date(createdOnParts[1]+'/'+createdOnParts[0]+'/'+createdOnParts[2].split('.').join('')));

Apply the same technique to ModifiedOn.

Again, this JS file may get overwritten when you install update in the future.

Adam747 responded on 12 Jun 2014 12:26 AM

Thank you for taking the time to show us an example, however this has failed and it seems that the problem is deeper in the CRM application, I proved this by using your code and hard coded the dates to see where the problem occurs, this is what I used;

var createdOnParts=annotationUI.CreatedOn.toString().split("/");



createdOnParts[2]="2014 10:32 pm";

$v_0.set_createdOn(new Date(createdOnParts[1]+"/"+createdOnParts[0]+"/"+createdOnParts[2]));

The above returns 'Today 10:32:00' in the CRM application, if I set createdOnParts[1]=05 then the CRM application returns '23 May 2014 10:32:00'.

So there it appears re-formatting the dates in JS will not help and the problem is in the date handling in the application.

Why won't MS fix this???

Adam747 responded on 12 Jun 2014 1:59 AM

Opps... my bad!  It would've helped if I had used 2013 and not a date greater than today! so with

var createdOnParts=annotationUI.CreatedOn.toString().split("/");



createdOnParts[2]="2013 10:32 pm";

$v_0.set_createdOn(new Date(createdOnParts[1]+"/"+createdOnParts[0]+"/"+createdOnParts[2]));

the returned text is '23 June 2013 10:32 pm' as it should be. I just need to find out why your code generates an error, there must be a difference on the format of the date.

Adam747 responded on 12 Jun 2014 2:07 AM

I've used an alert to display the text of annotationUI.CreatedOn.toString() and the format is very strange looking and I'm not sure what's going on with the year? Here's a couple of results;

Wed Feb 3 09:01:57 UTC 2016

Tue Jun 3 10:36:02 UTC +0100 2014

I can see why your code doesn't work now :o(

Adam747 responded on 12 Jun 2014 3:18 AM

I've checked further into this and it seems the problem must in the population of the AnnotationCollection which is holding dates in UTC format but whatever populates the class must be expecting a US format date from the DB but receiving a UK date and so it's messing up the UTC date.

The results I get from the UI dates compared to the DB dates are as follows;

annotationUI.CreatedOn : Wed Nov 12 16:18:24 UTC 2014

DB createdDate : 2014-03-26 09:01:57.000

annotationUI.ModifiedOn:Wed Feb 3 08:54:01 UTC 2016

DB ModifiedDate : 2014-03-26 09:01:57.000

Can you offer any further advice?

Bin responded on 12 Jun 2014 3:03 PM

My annotationUI.CreatedOn format is different from yours: 15/05/2012 1:10:19 p.m.

you need to figure out why the annotationUI.CreatedOn is Wed Nov 12 16:18:24 UTC 2014 if your DB  createdDate is 2014-03-26 09:01:57.000.

You can check the original data send back from the service (open your browser developer tool and capture the network traffic, click the NOTES on your entity form enforce to refresh the notes, you will see a post request/response for /AppWebServices/Annotation.asmx then check the response body)

Adam747 responded on 13 Jun 2014 1:06 AM

Thanks for your advice, it seems I'm getting a little closer, I must have got the dates mixed up before but now I've tied them back to the note subject and this is the results I get from the DB, the Java Code and the browser, the java dates are confused but the dates sent to the browser are correct, how can that be?


DB Created: 2014-03-11 12:50:46.000

DB Modified: 2014-06-12 09:06:03.000

annotationUI.CreatedOn: Mon Nov 3 12:50:46 UTC 2014

annotationUI.ModifiedOn: Sat Dec 6 10:06:03 UTC 2014

Browser <CreatedOn>11/03/2014 12:50:46</CreatedOn>

Browser <ModifiedOn>12/06/2014 10:06:03</ModifiedOn>

DB Created: 2013-12-23 16:18:24.000

DB Modified: 2014-03-26 08:54:01.000

annotationUI.CreatedOn: Wed Nov 12 16:18:24 UTC 2014

annotationUI.ModifiedOn: Wed Feb 3 08:54:01 UTC 2016

Browser <CreatedOn>23/12/2013 16:18:24</CreatedOn>

Browser <ModifiedOn>26/03/2014 08:54:01</ModifiedOn>

DB Created: 2014-03-26 09:01:57.000

DB Modified: 2014-03-26 09:01:57.000

annotationUI.CreatedOn: Wed Feb 3 09:01:57 UTC 2016

annotationUI.ModifiedOn: Wed Feb 3 09:01:57 UTC 2016

Browser <CreatedOn>26/03/2014 09:01:57</CreatedOn>

Browser <ModifiedOn>26/03/2014 09:01:57</ModifiedOn>

Bin responded on 15 Jun 2014 2:08 PM

I think you just need to modify the code of composing the annotationUI.ModifiedOn (swap day and month).

Or you can check your local computer time zone setting, browser setting and CRM personal standards and formats option.

Adam747 responded on 16 Jun 2014 12:07 AM

My PC is Windows 7 with regional settings set to 'English (Untied Kingdom) and my browser is IE10 with language set to 'English (united Kingdom) [en-GB]'.

The CRM DB is Windows Server 2012 with a backend SQL Server 2012, the DB Default Language is set to 'British English' and so are all the users.

My instance of CRM has formats set to 'English (United Kingdom)'.

From what I can tell from the code, the AnnotationUI object belongs to a collection called 'AnnotationCollection' and, I believe, this collection is created via the 'Wall.Interfaces' which I think are DLL libraries and thus I can't modify the source of AnnotationUI.

Please let me know if I'm wrong.

FinneyA responded on 16 Jun 2014 5:46 AM

You can simply go to settings>Administration>System settings>Formats, check the current format is the one you desire so English(United Kingdom) then click customise when correct. Go to the 'date' tab, change the short date format to dd/MM/yyyy & the long date format to dd/MMMM/yyyy. Hope this helps.

Adam747 responded on 16 Jun 2014 5:52 AM

Thanks for your input, but the problem is deeper within CRM, and my CRM formats are already set to 'English (United Kingdom) as previously mentioned. Also, formats are based on a selection and can not be entered so the long format selection is 'dd MMM yyyy' without any slashes.


Verified Answer
Thomas Rath responded on 19 Jun 2014 11:57 AM

Hi all

I must admit i have not read all your posts. But I think I have a fix for your problems. We encountered the same problem in our CRM2013 on-prem after migrating from CRM on-line. Dates where either shown as "invalid date" or completely wrong. There is not doubt that there is a serious bug in the product. But the work around that fixed it for us was to change the date format on the CRM server to English (US).

Follow these steps:

1. Open the IIS manager

2. Choose .Net Globalization

3. Change Culture and UI Culture to "English (United States) (en-US)". I don't know if both are necessary.

4. Apply changes

5. Do an IIS reset

Bada bing! That fixed our date issue!

Hope it helps other with similar problems.

Kind regards

Thomas Rath, Norriq Denmark