We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Filtering entries for the current day

How Do I?

Noor M's avatar
Noor M
99 posts
10 years ago
Noor M's avatar Noor M

Hello,

I am trying to filter entries from a single channel whose entries’ dates fall in today’s range i.e. 00:00 to 23:59

As per the documentation I have followed at https://ellislab.com/expressionengine/user-guide/channel/channel_entries.html#start-on

My EE code is

{exp:channel:entries channel="news" status="open|featured|promo" category_group="1" orderby="date" sort="desc" start_on="<?php echo $start_time; ?>"}

I have entries which are 3 days old and they still show up!

       
GDmac - expocom's avatar
GDmac - expocom
350 posts
10 years ago
GDmac - expocom's avatar GDmac - expocom

If you enable template debugging and also the profiler, look at what the entries tag receives for start_on=”” and see how that translates to the actual query that is being executed. Also, when building custom entries tags with parameters i tend to specify dynamic=”no”. This prevents EE from doing guesses based on the URI, just in case.

       
Noor M's avatar
Noor M
99 posts
10 years ago
Noor M's avatar Noor M

Thanks GDmac for the suggestion.

It worked when I used the following code

{exp:channel:entries
       channel="news"
       status="open|featured|promo"
       category_group="1"
       orderby="date"
       sort="desc"
       start_on="today"
       stop_before="{current_time format="%Y-%m-%d %H:%i:%s"}"
}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.