I'm having absolute brain fog right now.

I'm trying to show a list of entries with a given postDate

{% set startDate = startDate ?? now|date('Y-m-d') %}

.section(['jobs', 'userPostedJobs'])
.postDate(">=" ~ startDate)

Am I right in saying though that if my date was 2022-04-16 that this would include all entries after that date also?

Have also looked at .postDate(['and', ">= #{startDate}", "< #{startDate}"]) that yields no results

1 Answer 1


You’d need to define a range that begins today and ends tomorrow.

{% set startDate = startDate ?? now %}
{% set endDate = startDate|date_modify('+1 day') %}

{% set entries = craft.entries()
  .section(['jobs', 'userPostedJobs'])
    ">= #{startDate|date('Y-m-d')}",
    "< #{endDate|date('Y-m-d')}"
  .all() %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.