cancel
Showing results for 
Search instead for 
Did you mean: 

Date difference in Custom C# classes

Former Member
0 Kudos

I've created a BCS query class via the following example

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50dbff87-ae37-2f10-9eb2-ee3669a69...

The DataTable that is returned is then transformed into a internal Collection class and further displayed on a custom Web Part

When i look into the returned DateTime values it seems that the clock is turned back 2 hours: {7/15/2012 10:00:00 PM}

Looking at the External List the date is 7/16/2012 12:00:00 AM, which is the correct date.

I suspect it has something to do with UTC times or regional settings in SharePoint. I have the same experience with an XSLT webpart by the way.

What is the best way to solve this? (Of course I can add 2 hours to the date )

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Michiel,

The noticed effect happens due to the UTC to user time zone conversion between SAP and SharePoint. Duet Enterprise out-of-the-box expects al the returned SAP date times to be in UTC format; and converts this in SharePoint into the user time zone.

The 2-hours gap can be the result of missing time-information in the returned SAP UTC date time --> the RFC only returns Date. If so, ways to deal with this:

* If you have control over the RFC (custom RFC) then convert the Date into UTC using users time zone in the backend

* If it is a standard RFC; wrap it in a custom RFC, and fix the UTC value there

Regards, William.