API, Programming

Solved: odata filter by datetime with greater than (or less than) range

Need to filter your odata query and only have the datetime value to work with?

if your format looks like: 2018-12-31T00:00:00

Then you can query it by wrapping it in a datetime tag with quotes. see example below with it combining with an ID filter to only show a person’s information greater than 1/1/2018

https://yourserver/yourservice/YourData?$filter=(%20ID%20eq%201234%20and%20EXP_DATE%20gt%20datetime%272018-01-01T00:00:00.000%27)

Note: you can also do other options like less than (lt) or others.

Onward!

Questions? Comments?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s