0

I have a monthly event. I want to say "The date/time of the next event is [time]".
Lets say, the 5th of every month, from 5pm-6pm.

If it's currently January 4th, it'll say the next date is January 5th.
If it's currently January 6th, it'll say the next date is February 5th.

Additionally, I'll need to account for the day itself.

If it's currently January 5th: from 5pm to 6pm I want it to say the event is on now.
If it's currently January 5th, from 6pm onwards I want it to say the next date is February 5th.

I just don't know how to even begin using dates in conditionals, etc.
Any help would be appreciated. Thanks!

Edit:
These events aren't channel entries, they are just a known monthly date and I needed to check whether the current time is before, after or during the event.
This has been solved.

1

Can you use Low's nice date for this? It has a range setting.

http://gotolow.com/addons/low-nice-date/

| improve this answer | |
1

If each instance of the event is an entry, you might want to check out Solspace's Date Field Filter - which allows you to map a custom date field as the field upon which you would like to effect EE's native date functionality (oddly, date fields other than the actual entry date field behave differently) and allows you to specify a dynamic start and end date/time for the range (or open ended, looking forward, which I think is what you would want). I've used it a bunch of times and it worked great for this sort of thing. You could map your date field as your end date (so that an event that isn't yet over still displays) and do a simple comparison of your custom end time field against current_time to be able to flag an event as "going on now"

| improve this answer | |
  • I've used the addon you're referring to before, and it's great. Unfortunately, these events aren't entry based. – Jason Varga Jul 9 '13 at 19:08
0

I ended up needing to write a plugin to handle this.

It just compares the event date/time and the current date/time, and outputs different date strings.

| improve this answer | |
0

I do not fully understood how you're trying to do this, but you can always use "%U" as format for using dates on conditionals:

{if {current_time format="%U"} > {field_start_date format="%U"} }
    {if {current_time format="%U"} < {field_end_date format="%U"} }
        event now
    {/if}
{/if}

Or, you can use format="%Y%m%d" for checking just on a interval of 24 hours.

| improve this answer | |

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.