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

What is date formatting variable for present?

How Do I?

Senad Milavic's avatar
Senad Milavic
6 posts
8 years ago
Senad Milavic's avatar Senad Milavic

I’m setting up a page displaying events with start and end dates. I have set up corresponding date fields for the channel with date field for start date and date field for end date. I followed the Date Variable Formatting guide from user guide to set up countdown messages depending if current date is before start date for event or if current date is past end date for event. The code looks like this and works fine with future and past parameters:

{event_starts:relative units="years|months|weeks|days" depth="2" future="<b>Starts in:</b><br> %s" past=""}
{event_ends:relative units="years|months|weeks|days" depth="2" future="" past="<b>Finished:</b><br> %s ago"}

But how do you show a message saying the event is currently running if today’s date is between start date and end date?

Only parameters for date variable formatting I could find are future and past where you can set how countdown will work, but what parameter or combination of these should be used to say if date is past start date and end date is in future, then display message saying “Event is currently running”? As there is no “present” parameter in date formatting which would check if date is between 2 dates and display a message if it is, how would you achieve this?

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
8 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

I’m not sure this will help as I’m not familiar with the addon you are using. But EE does have the {current_time} global variable and it takes the standard date variable formatting parameter, for example: {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.