When you want to filter rows from a Dataverse table based on a date field while ignoring the time, you can use the ge (greater than or equal to) and le (less than or equal to) operators to specify a date range.
Using ge and le together:
- The filter 'createdon ge '@{formatDateTime(utcNow(),'yyyy-MM-dd')}' and createdon le '@{startOfDay(addDays(utcNow(),1),'yyyy-MM-dd')}'` checks if the `createdon` date is greater than or equal to the current date (ignoring the time) and less than or equal to the start of the next day (ignoring the time). By combining these two conditions, you effectively filter for rows where the `createdon` date is exactly today, ignoring the time component.
Using only ge:
- The filter `createdon ge '@{formatDateTime(utcNow(),'yyyy-MM-dd')}'` checks if the `createdon` date is greater than or equal to the current date (ignoring the time).
When to use each approach:
- Use `ge` and `le` together when you need to filter for rows within a specific date range, such as all rows created on a particular day.
- Use only `ge` when you want to filter for rows created from a specific date onwards, including all times on that date.
Example scenarios:
- Filtering for today's records: Use both `ge` and `le` to ensure you capture all records created today, regardless of the time.
- Filtering for records from today onwards: Use only `ge` to include all records created from today onwards, including future dates.
Important note: be sure to format the expressions using the date format yyyy-MM-dd as this is the ISO8601 format. Using another date format will not work.