SAP Knowledge Base Article - Public

3348259 - OData API - EmployeeTime/lastModifiedDateTime not filtering correctly

Symptom

You are retrieving EmployeeTime data from SuccessFactors using OData API & filtering on the lastModifiedDateTime property:

 

You observe in the response, that records with lastModifiedDateTime value outside of your filters are being returned:

  • <d:lastModifiedDateTime m:type="Edm.DateTimeOffset">2023-02-01T02:32:50Z</d:lastModifiedDateTime>

     
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

 

Environment

  • SAP SuccessFactors HXM Suite
  • OData API

Cause

This behaviour is happening due to the fact that we are comparing a datetimeoffset (lastModifiedDateTime) to datetime (2023-02-01T03:32:00Z):


  •   

Properties of type: datetime & datetimeoffset are not the same & behave differently

  • Generally for the lastModifiedDateTime of type: datetime the input value is in UTC time, and it is stored and retrieved from the database in the same format.
     
  • Generally for the lastModifiedOn of type: datetimeoffset it takes time zone into account when converting dates 
      
    You can read more about this in the API documentation: Using the DateTime Format  & Using the DateTimeOffset Format

  

Resolution

To make the above query filter behave as you expect, you would need to include datetimeoffset before the timestamp in the filter:

 

Another option is to instead use the lastModifiedDate property which is of type datetime:

 

However as a general recommendation, we would suggest checking the property being filtered within the OData API Data Dictionary to determine it's type (datetime or datetimeoffset)

Then place the type before the timestamp value in the query to ensure same types are being compared

Keywords

EmployeeTime, lastModifiedDateTime, lastModifiedOn, datetime, datetimeoffset, filter, format , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-EC-TIM , Time Off , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , Problem

Product

SAP SuccessFactors HCM suite all versions