Craft CMS Asked by brynli64 on March 4, 2021
I’m trying to show only entries for the created in the last month. I’ve taken this from the example in the docs but it ends up showing nothing. There’s 100% entries with a postDate in the last month.
What am I missing?
{% set start = now|date_modify("-1 month")|date('Y-m-d') %}
{% set end = now|date('Y-m-d') %}
{% set newsQuery = craft.entries({
section: 'news',
postDate: ['and', ">= #{start}", "< #{end}"],
}) %}
Thanks!
Immediately found a solution!
{% set newsQuery = craft.entries({
section: 'news',
after: now|date_modify('0:00 -1 months'),
}) %}
Answered by brynli64 on March 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP