BizTalk and the UTC time problems…

Recently I stumbled upon a problem hat has definitely touched me so many times in the last years before, that I decided to write this little blog post about it.

You extract a value of type xs:date from a BizTalk message and use it for further processing e.g. calling a web service, query a database or something else.
But the date changed. In my case I got a request message with a valuation date of “2013-09-01”.
After extracting the date from the message in an orchestration shape and assigning it to a variable of type System.DateTime I recognized that the value seem to be changed.
I see the value “2013-08-31”. 

Of course it did not. Just the “representation” changed.
BizTalk internally works with UTC. So what appears is the UTC representation of the date-time value.
In my case (GMT+1) the date time value appears as “2013-08-31 23:00:00”

Just perform the .ToLocalTime() function on the date you extracted from the message. And than you are fine. (normally)



Furthermore I deeply recommend the blog post “DateTime considerations for BizTalk” by Michael Stephenson.



Leave a Reply