CRM dates one day too early when accessing them via LINQ

For one of my a clients I had to make something to import records from their old invoicing system into the new CRM via csv files. When this was completed it had to export result data they would use to check if all the data was transferred correctly. Because they had to "practice" this import many times I decided to make a Windows Forms application and access the CRM data via the API using LINQ.

In the exported data I noticed that date fields came out one day too early. For example in the CRM interface the date was shown as 6/25/2015 but in my export files the dates showed up as 6/24/2015 which looked like very strange behavior to me.

After some investigation I noticed that date time fields in CRM are saved in the database as CET time. The project location was the Netherlands so the time difference with CET was 2 hours. When you have a CRM date only field it will send the time part along as 00:00:00 so when I entered 6/25/2015 in CRM it turned up as 6/24/2015 22:00:00 in the database.

So this way, when selecting date/time values via LINQ you come up one day short. This can be a nasty little problem that may cost you a lot of time to figure out.

Anyway, the solution for this problem is rather simple. Just convert the date time field ToLocalTime()

var contact = (from c in ContactSet
               where c.FullName == "Edwin Hebbink"
               select c).FirstOrDefault();

Just replace the "Edwin Hebbink" part with some contact name you have in your CRM and run this piece of code in LINQPad for CRM as a C# Statement and you will get the following result:

As you can see the first date is one day earlier then the second one.

If you want to read some more about CRM date/time issues this would be a very interesting article. In that article they talk about CRM 2011 but all this stuff still applies to the later versions as well.

Comments (6) -

  • article writing service

    1/4/2017 9:41:07 AM |

    I really want to get through the problems that I have with my laptop.


    1/28/2017 3:44:00 PM |

    That's great. I would like to get here more details on the topic. I think that some of those materials should be important for the understanding of the whole thing.

  • proofreading editing services

    2/8/2017 7:17:01 PM |

    Yes, I have this sort of a problem since. It was highly complicated for me. So, I've asked for a help.

  • BWVlndv

    4/19/2017 4:22:11 AM |

    380066 362257I liked than you may be right now. 626837

  • trenadex acetate 100

    5/19/2017 11:49:13 AM |

    693587 304257Deference to op , some  superb   entropy. 169133

  • personalised workwear clothing

    5/20/2017 2:17:34 PM |

    174733 678378I really    glad  to locate this  web site on bing, just what I was searching  for : D  as properly  saved to favorites . 880021

  • motor club of america training

    5/22/2017 5:16:35 AM |

    297235 429321An intriguing discussion is worth comment. I do feel which you really should write read far more about this subject, it will not be considered a taboo topic but normally every person is too couple of to communicate in on such topics. To one more. Cheers 744338

  • serrurier agréé assurance

    5/24/2017 2:58:05 PM |

    212087 553339dog grooming is the specialty of my sister, she really loves grooming every dog in our house   852067


    5/24/2017 3:26:11 PM |

    469411 145496Its  superb  as your other posts  : D,  regards  for posting . 332086

  • Emobility

    5/27/2017 10:21:20 PM |

    863505 574999My wife style of bogus body art were being quite unsafe. Mother worked with gun initial, following which they your lover snuck totally free upon an tattoo ink ink. I was certain the fact just about every ought to not be  epidermal, due to the tattoo ink could be attracted from the entire body. make an own temporary tattoo 578030

  • georgia

    5/30/2017 9:39:34 AM |

    45423 320996Fairly uncommon. Is likely to appreciate it for men and women who incorporate community forums or anything, internet internet site theme . a tones way for the client to communicate. Exceptional job.. 131270

  • 741846 940784Hey I was just searching at your web site in Firefox and the image at the top with the link cant show up properly. Just thought I would let you know. 161521


    5/31/2017 1:17:59 PM |

    239522 952436You�ve created various good points there. I did specific search terms about the matter and located mainly individuals will believe your web site 448258

  • Family

    6/4/2017 5:05:56 PM |

    505432 716673This sort of wanting to come to a difference in her or his lifestyle, initial usually Los angeles Excess weight weightloss scheme is really a large running in as it reached that strive. weight loss 631505

  • 956283 938571Hmm is anyone else encountering problems with the pictures on this blog loading? I�m trying to figure out if its a problem on my end or if it�s the blog. Any responses would be greatly appreciated. 940285

  • cara pendaftaran cpns

    7/14/2017 3:04:06 PM |

    137167 223546I  as effectively  believe   thence , perfectly  pent  post! . 127900

  • GVK Biosciences

    7/14/2017 3:15:29 PM |

    763328 474585Hosting a blog composing facility (in a broad sense) requires unlimited space. So I suggest you to discover such web hosting (internet space provider) that offer flexibility inside your internet space. 989659

  • mtn

    7/18/2017 10:56:26 PM |

    156476 197595So, is this just for men, just for women, or is it for both sexes If it s not, then do women require to do anything different to put on muscle 943005

  • La Liga Predictions

    7/20/2017 7:42:12 PM |

    613329 821173The subsequent time I read a weblog, I hope that it doesnt disappoint me as a great deal as this 1. I mean, I know it was my option to read, but I truly thought youd have something attention-grabbing to say. All I hear is actually a bunch of whining about something which you possibly can repair need to you werent too busy on the lookout for attention. 766437

  • get seedbox

    7/21/2017 2:59:59 PM |

    769950 432250hey was just seeing if you minded a comment. i like your site and the theme you picked is super. I will be back. 160353

  • TS TV Escorts from London

    7/28/2017 3:38:49 PM |

    571583 707393There exist a couple of a lot of different distinct levels among the California Weight loss program and each and every a person is pretty crucial. You are procedure stands out as the the actual giving up with all the power. weight loss 809722

  • מיזוג אוויר

    8/17/2017 2:35:36 AM |

    296854 273944I  real   glad  to find this  web website  on bing, just what I was  searching  for : D  likewise   saved to bookmarks . 18733

  • gambar pemandangan

    8/28/2017 10:40:02 PM |

    410196 28483I like this  internet blog  very a lot so a lot  superb  info  . 189484

  • roofing

    8/30/2017 1:58:34 PM |

    482524 792997This really is such an excellent post, and was thinking significantly exactly the same myself.  An additional great update. 634703

  • gvk biosciences

    9/6/2017 10:50:42 AM |

    844019 203425Lastly, got what I was seeking for!! I�ve actually enjoying every small bit of this. Ecstatic I stumbled into this post! and also I�ve bookmarked to look at unique data for your weblog post. 361702

  • Sistem Klinik

    9/15/2017 3:29:20 AM |

    131347 374190An fascinating dialogue is value comment. I feel that it�s greatest to write extra on this matter, it might not be a taboo topic even so generally people are not enough to speak on such topics. To the next. Cheers 775709

  • seo company

    9/27/2017 8:50:03 AM |

    765723 875267Simply  wanna  remark  that you have a extremely good    internet internet site , I  enjoy  the  layout it  in fact stands out. 821841

  • Recommended Site

    9/28/2017 7:41:51 AM |

    592756 280640What a lovely blog. I will undoubtedly be back. Please maintain writing! 504877

  • play soccer physics game online

    9/28/2017 5:00:12 PM |

    271017 268291I like the valuable info you give in your articles. I�ll bookmark your weblog and check again here often. I�m quite certain I�ll learn plenty of new stuff correct here! Finest of luck for the next! 459555

  • make money with a iphone

    9/29/2017 11:50:25 PM |

    842313 797939Sounds like some thing a great deal of baby boomers really should study. The feelings of neglect are there in a lot of levels when a single is over the hill. 857991

  • Eavestrough Cleaning

    10/1/2017 6:02:32 AM |

    510458 867255Pretty part of content material. I just stumbled upon your weblog and in accession capital to assert that I get truly loved account your weblog posts. Any way I�ll be subscribing on your feeds or even I success you access constantly quick. 146119

  • adme

    10/6/2017 2:16:49 PM |

    184445 231773I got what you mean  ,bookmarked , very nice    internet web site . 653995

  • pornhub

    10/9/2017 2:15:34 PM |

    961556 662457Totally   indited content material , Genuinely enjoyed  seeking at . 672934

  • 黑店忠誠X(香港)請傭僱小心

    10/12/2017 5:27:55 PM |

    239698 473600Wonderful! This weblog looks just like my old one! It is on a entirely different subject but it has pretty considerably the same layout and design. Excellent choice of colors! 819759

  • how to make money with a iphone

    10/15/2017 7:24:56 AM |

    398959 874964bless you with regard to the certain weblog post ive really been looking regarding this kind of data on the web for sum time right now as a result cheers 946616

  • Bolide

    10/20/2017 10:22:56 PM |

    686384 668464We don�t trust this wonderful submit. Nevertheless, I saw it gazed for Digg along with I�ve determined you can be appropriate so i ended up being imagining within the completely wrong way. Persist with writing top quality stuff along these lines. 135621

  • newborn photography

    10/24/2017 2:06:51 PM |

    943572 671041hello, your internet site is actually very good. We do appreciate your give very good results 775266

  • family photography

    10/24/2017 6:28:38 PM |

    631173 291198As soon as I found  this  internet website  I went on reddit to share some with the love with them. 129362

  • iraq political & Law

    10/27/2017 6:58:35 PM |

    623843 613439This is a quite exciting write-up, I�m seeking for this know how. So you realize I established your internet internet site when I was searching for sites like my own, so please appear at my internet internet site someday and post me a opinion to let me know how you feel. 194996

  • masini inghetata pret

    10/28/2017 9:41:45 PM |

    710125 334000Register a domain, search for available domains, renew and transfer domains, and decide on from a wide variety of domain extensions. 876843

  • roofing contractor

    11/1/2017 8:13:32 PM |

    621645 781740bmmzyfixtirh cheapest phentermine zero health expert prescribed qrdzoumve buy phentermine diet pill iixqnjouukkebr 694834

  • Diyala Arts

    11/2/2017 6:07:27 PM |

    251740 371459More than and over once more I think about these concern. As a matter of fact it was not even yesterday that I last thought about it. To be honest, what is your thought though? 415505

  • check

    11/16/2017 11:22:22 AM |

    223075 480771An intriguing discussion is worth comment. I feel that you need to write a lot more on this subject, it may possibly not be a taboo subject but usually people are not enough to speak on such topics. Towards the next. Cheers 170758

  • Best DMPK Services

    11/21/2017 5:37:03 AM |

    940905 231591Over and over again I take into consideration these concern. As a matter of fact it was not even yesterday that I last thought about it. To be honest, what is your thought though? 404384

  • Late holiday deals

    11/21/2017 11:28:30 AM |

    97844 335814Merely  wanna  state  that this is  very beneficial , Thanks for taking your time to write this. 415486

  • 0RZof0gUMbNRj

    2/8/2018 5:46:45 PM |

    287835 433231quite good post, i surely genuinely like this remarkable internet site, maintain on it 677835

  • personal cash advance chicago

    4/8/2018 9:47:17 AM |

    This is the reason you ought to be careful about the ads that are oftentimes observed. In any case with reference to how edgy your circumstance might be, you will in any case need to set aside the opportunity to consider the greater part of your choices previously you choose the best strategy.