Reputation: 77
I want to return all entries that are entered today does not matter the time I use this to insert
INSERT INTO hangfire.job(stateid, statename, invocationdata, arguments, createdat, expireat, updatecount)
VALUES (44, 'Schedule', 'Test Invocation data', 'Test arguments', now()::timestamp, null, 0);
And use this to retrieve the data but it returns nothing only the fields
SELECT * From hangfire.job WHERE createdat = now()::timestamp;
Upvotes: 0
Views: 34
Reputation:
A timestamp contains a time (as the name indicates), if you want to ignore that time, use a date
:
SELECT *
From hangfire.job
WHERE createdat::date = current_date;
If you have an index on createdat the above will not use that index. If you need that for performance reasons, use a range condition:
SELECT *
From hangfire.job
WHERE createdat >= current_date
AND createdat < current_date + 1;
Upvotes: 1