Question

Odata $filter Date Syntax

  • 2 June 2023
  • 2 replies
  • 1808 views

Userlevel 3
Badge +7

Dear all,
I’m using the Odata query below, it works, however it seems all records having EMPLOYMENT_END_DATE equal to todays date are ignored due to date format.

page/Employees/List?$filter=CompanyId eq $COMPANY_ID$ and EmploymentEndDate le DayAfterMonth and EmploymentEndDate ge CurrentDate

What are supported date variables/functions I can use with Odata query?
I see DayAfterMonth, CurrentDate are working. Are there any others like Yesterday or is it possible to deduct/add number of days to the CurrentDay somehow, can I somehow truncate the date?
I did not find even DayAfterMonth, CurrentDate in the documentation.
Thanks Jan


2 replies

Badge +1

Hi,

OData provides Date and Time Functions that can be used in $filter expressions.

To retrieve specific parts of a date, you can use functions like day(), month(), year(), hour(), minute(), and second(). For example:

$filter=day(BirthDate) eq 8
$filter=month(BirthDate) eq 5

These functions allow you to extract data such as day,month from a given date field.


You can find more information about these Date and Time Functions in the OData documentation. Odata Documentation

IFS OData Provider currently does not support certain methods, and arithmetic operations are not permitted with properties of Date, Time, or DateTimeOffset. Please consult the IFS technical documentation for more details. IFS Documentation


You are able to work with the DayAfterMonth and CurrentDate variables because they are date attributes of CompanyPerson entity of EmployeesHandling. Odata allows you to compare and perform operations involving two date attributes within your OData queries.

Badge +2

Hi @PathLK Is there any  support to  arithmetic operations with properties of Date, Time, or DateTimeOffset with the latest Versions of IFS such as 24R1 etc.?

 

 

Reply