C
C#8mo ago
FraznoFire

Azure Table Client Query Filter not evaluating correctly

Hi everyone, I am building an app with Azure Functions written in .NET 8, and one part of the app is a cleanup function that deletes items older than 1 week, but when I query the table for items older than one week, it doesn't return anything, despite verifying that there are multiple entities in the table with timestamps older than a week, I have confirmed removing the filter returns all items, so there is something wrong with the expression itself, but I can't figure it out for the life of me. The snippet of code is as follows:
DateTimeOffset oneWeekAgo = DateTimeOffset.UtcNow.AddDays(-7);

string QueryFilter = $"Timestamp lt datetime'{oneWeekAgo:s}'";

Pageable<item> queryResults = tableClient.Query<item>(filter: QueryFilter); // is currently returning nothing
DateTimeOffset oneWeekAgo = DateTimeOffset.UtcNow.AddDays(-7);

string QueryFilter = $"Timestamp lt datetime'{oneWeekAgo:s}'";

Pageable<item> queryResults = tableClient.Query<item>(filter: QueryFilter); // is currently returning nothing
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server