ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

add default entry date value for time?

June 07, 2012 12:18pm

Subscribe [1]
  • #1 / Jun 07, 2012 12:18pm

    soire

    25 posts

    Hello!

    I am making an events list in a channel called “events”. I am displaying today and future events by using the following parameter:

    start_on="{current_time format='%Y-%m-%d %H:%i'}"

    This is fine and good (so far) except for that I have to enter 11:59 PM to override the actual time that this was entered as the time for an entry once I choose a date in the date picker. (whew, hope that made sense!) For example: I entered in an event for 06/07/2012 on the previous day at 1:06 AM. Once it was 06/07/2012 at 1:07 AM that event was removed from my channel entries on the front end, which isn’t what I wanted to accomplish.

    I’m wondering if there is a way to override the auto-populated time portion of that date when I enter a new entry so that it populates with 11:59 automatically? Or just uses only the full day, rather than a down-to-the minute time?

    I suppose I could change my system to employ the use of an expiration date, but I’m trying to make the process as simple as possible for a client to add more events. Can I just remove the

    %H:%i

    portion and have the start_on parameter function like I’m desiring? So something like:

    start_on="{current_time format='%Y-%m-%d'}"

    Thanks for any help with this! Perhaps I just need to envision this differently?

     

  • #2 / Jun 08, 2012 2:52pm

    Dan Decker

    7338 posts

    Hi soire

    Thanks for your question!

    You should be able to input the value directly. For example:

    start_on="{current_time format='%Y-%m-%d 11:59'}"

    The variable will output something similar to this:

    2012-06-08 11:59

    Hope that helps!

    Cheers,

  • #3 / Jun 08, 2012 3:22pm

    soire

    25 posts

    Thanks Dan! Is there a way to specify AM or PM, or will the 11:59 do it on its own?

  • #4 / Jun 12, 2012 1:01pm

    Robin Sowell

    13255 posts

    It defaults to 24 hour format unless am/pm is specified.  So you’d either want to change it to 23:59 or %Y-%m-%d 11:59 PM.

    You may optionally use a 12 hour time format by including am/pm notation (2004-06-05 20:00 is equivalent to: 2004-06-05 08:00 PM and 2004-06-05 08:00 pm; 2004-06-05 08:00 is equivalent to: 2004-06-05 08:00 AM and 2004-06-05 08:00 am).

    Note: If you are using a non-English language pack, it’s necessary to use a 24 hour format only, as the AM/PM indicators may have been changed.

    The docs go into a bit more detail, but that’s the gist of it.

    Which was a long way of saying- you’ll want to tweak it just a bit to achieve the desired effect.  😉

  • #5 / Jun 12, 2012 1:59pm

    soire

    25 posts

    Awesome! Thanks for the responses Robin and Dan. I just plugged 23:59 in. Just to confirm that I’m understanding this correctly, the

    start_on="{current_time format='%Y-%m-%d 23:59'}"

    bit that I changed in my channel entries tag will override any hour/minute related data input by an entry?

    Thanks again.

  • #6 / Jun 13, 2012 4:49pm

    Dan Decker

    7338 posts

    Hi soire,

    bit that I changed in my channel entries tag will override any hour/minute related data input by an entry?

    That will tell the channel entries tag to start pulling entries *at and after* that time, does that answer your question?

    Cheers,

  • #7 / Jun 13, 2012 4:52pm

    soire

    25 posts

    I think so. What I was looking for confirmation on was if I have the channel entries tag with this parameter

    start_on="{current_time format='%Y-%m-%d 23:59'}"

    and someone inputs an entry date of 2012-06-24 11:09 AM

    I want to make sure that my “hard coding” of 23:59 will override the 11:09 AM so the entry will still appear until 23:59. Does that make sense?

  • #8 / Jun 14, 2012 3:45pm

    Dan Decker

    7338 posts

    Hi soire,

    I want to make sure that my “hard coding” of 23:59 will override the 11:09 AM

    Not quite - the parameter is telling channel entries “when to start looking”. It has no effect on the entry date itself, as it is input in the Control Panel when publishing an entry.

    With the start_on you are saying:
    “Based on the value that was entered when the entry was published, star on this date and this hour and pull everything from that point forward in time”

    If you want to show all event entries for “today” you would need to set the time to 00:00 or 12:00 AM - that would pull everything for “today”.

    I hope we haven’t confused each other!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases