So I want to show "Open-Now" if the current time is in betwee in the open hours (which are put in a grid time select field).

This is what I have right now:

{if {current_time format="%h"} >= {branch_hours:opening_hour} && {current_time format="%h"} <= {branch_hours:closing_hour} } <span class="open-now text-right">Open Now</span> {/if}</p>

It's not really working, and not sure why? Is what I'm aiming for even possible?

  • 1
    Just output those bad boys next to eachother without the if command and report back. What does {current_time format="%h"} - {branch_hours:opening_hour} - {branch_hours:closing_hour} output outside of the if statement?
    – jrothafer
    Jul 16 '15 at 18:41

jrothafer's troubleshooting suggestion will tell you a lot. If that looks good, try putting the tags in single quotes like so:

{if '{current_time format="%h"}' >= '{branch_hours:opening_hour}' && '{current_time format="%h"}' <= '{branch_hours:closing_hour}' } <span class="open-now text-right">Open Now</span> {/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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