Date/Time handling in the Microsoft Biztalk.NET SAP Adapter (WCF).

SAP has the data types DATS and TIMS, which mean Date and Time respectively. DATS means YYYYMMDD, and TIMS means HHMMSS, with no timezone information being stored anywhere. However, the adapter, working with SOAP messages, accepts date/time values having timezone information in them. Besides, since both are exposed as xsd:datetime, the adapter can accept an entire datetime value (i.e. a value containing both date and time components). How does the adapter convert them to a format which SAP understands? And how does the adapter convert the SAP values to XML format?

NOTE - The reason DATS and TIMS are exposed as xsd:datetime and not xsd:date/xsd:time, is so that the .NET proxies generated by SvcUtil.exe expose these fields as DateTime objects, rather than strings.

Sending Date/Time to SAP:

Firstly, the adapter reads the XML datetime value as a datetime in UTC format. The table below should clarify:

Value in Xml Value adapter sees
2006-03-03T18:00:00 2006-03-03T18:00:00
2006-03-03T18:00:00Z 2006-03-03T18:00:00
2006-03-03T18:00:00+05:30 2006-03-03T12:30:00

Next, for DATS, the adapter just ignores the time value. Similarly, for TIMS, the adapter simply ignores the date value.

Once the adapter has obtained the required value, it sends it to SAP.

Converting SAP Date/Time to XML:

For DATS:
20060303 (YYYYMMDD) will appear in XML as 2006-03-03T00:00:00

For TIMS:
183000 (HHMMSS) will appear in XML as 0001-01-01T18:30:00