month-from-dateTime in XPath constraint

1
I have entitiy with non-localized date attribute. I'm trying to retrieve data with date in chosen month so I used xpath constraint as a start: [month-from-dateTime(StartDate) = 9] In DB i have those dates: I should be able to retrive 3 of 4 objects and yet the only one I get is date 2018-09-13. Changing constraint to month earlier gives me other 3 rows so my conclusion is that this constraint doesn't consider beginning of month. Does anyone know this problem?
asked
1 answers
1

Hello Kamil,

You're probably looking at an issue with localised/non-localised data or with a current date comparison.

When handling UTC dates normally you would use UTC methods to ensure your data is handled properly (i.e. formatDateTimeUTC instead of formatDateTime) however in xpath a corresponding method is probably not available. 

And in the more likely case of month-from-date comparing to current date time I don't think your xpath will result in what you're expecting.

Personally I would suggest resolving this with a date constraint instead. Create two date time variables, one which is the start of the month and one which is the start of the next month and simply do [date>= startDate and date<nextMonthStartDate] instead.

Hope this helps

answered