0

I have been trying for a while to find datetime functions that work in Azure search queries. Functions such day(MyDateTime) or time(MyDateTime) to get the day of the week or time part respectively.

I have a Collection(Schedule{scheduleStart,scheduleEnd}) - Both properties being of DateTimeOffset, with which I query/filter using the lamda syntax like so:

$filter=schedule/any(d: day(d/scheduleStart) eq 1)

As far as I am aware and from what I have researched, the above day() function is a valid OData function but does not seem to work when ever I use it. I get the error Function 'day' is not supported...

So my question is. How can I get the day part or time part from a valid DateTimeOffset value in Azure Search using the query syntax? Do these functions exist?

I guess I can add another property to my model with the dayOfWeek int value, but I don't want to do that until I know there is a better way and it would only solve 1 of my problems anyway :)

Bheeks
  • 1
  • 1
  • Does this answer your question? [azure search - are datediff / dateadd functions available?](https://stackoverflow.com/questions/51156013/azure-search-are-datediff-dateadd-functions-available) – Bruce Johnston Sep 28 '20 at 23:13
  • Hi @BruceJohnston. Hope you well and thanks for the reply. So oData functions are still not supported I guess? I can get around the day of week issue by adding an int for dayOfWeek to the model. How do you think I can get around the issue of comparing times? I need to compare the Day of the week and the time of day irrelevant of the date. – Bheeks Oct 01 '20 at 01:18
  • I think you would have to store the date and time in separate fields, since a range comparison wouldn’t work. – Bruce Johnston Oct 01 '20 at 05:42

0 Answers0