Local DateTime CRM Online SSRS Report

Local DateTime in UK could get a bit tricky because of the summer time, where it is one hour less in UTC time.  This post will help you to find out the local Date.

There is a simple solution for this: Use the date only field from the dataset. When the CRM date attribute (e.g. “MyDate”) is declared in the Fetch XML query of your dataset, you get two SSRS fields in that dataset: MyDate and MyDateValue. The first one is a date only field in local time, so you can do something like Fields!MyDate.Value. The second one is a datetime field in UTC time. You are probably interested in the first one 😉

If you also want to force a UK time format, you can use the next expression:



CDate(iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 4, 2)) &

“/” & iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 1, 2)) & “/” & iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 7, 4))))

Just to say thanks to my colleague Mario (@mtcantero // http://crmandcoffee.wordpress.com/) for his input in this article.

About Ramon Tebar

Software Engineer specialised on Microsoft Technologies with experience in large projects for different industrial sectors as developer, consultant and architect. I enjoy designing and developing software applications, it is my job and one of my hobbies. I’m interested in design patterns, new technologies and best practices. Making those part of the ALM process is a great challenge. During the last years, I have specialised in Microsoft Dynamics CRM (now Dynamics 365). I customise and extend the platform to provide tailored solutions and integrations based on service-oriented architectures and messages queuing. Motivated by community events and contributor in blogs, technical books, open source projects and forums, I have been awarded Microsoft Most Valuable Professional (MVP) on Dynamics 365 (CRM) since 2012.

Posted on September 16, 2013, in CRM, CRM Online, SSRS and tagged , , . Bookmark the permalink. 1 Comment.

  1. thanks a lot. It was really helpfull

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: