Single Event Date/Time

Home Forums Ticket Products Event Tickets Plus Single Event Date/Time

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1218548
    Norbert
    Participant

    Hi, is there a way to display date and time seperate? I found the funktion tribe_events_event_schedule_details. Is the a funktion to return the date without time? I need to display the time at another place in a different style.
    All the best
    Norbert

    #1219198
    Nico
    Member

    Hi there Norbert,

    Thanks for getting in touch with us! I can help you on this 🙂

    is there a way to display date and time seperate?

    Sure, if you want to use ‘tribe_events_event_schedule_details’ you can use the filter ‘tribe_events_event_schedule_details_formatting’ to modify the arguments of ‘show end time’ and ‘time’. You’ll need to this conditionaly, not sure where you want to use this function with the time, Can you please let me know about it?

    Another option is to use tribe_get_start_date and tribe_get_end_date, which have parameters to control the formatting of the output.

    Please let me know if this helps,
    Best,
    Nico

    #1220170
    Norbert
    Participant

    Hi, Nico, thank you for response but sorry, but I don’t know what filter means.
    My requirement is to display the date. Without time. That means the day and the month like “18. January” and nothing else. Your suggestion tribe_get_start_date displays “18. January 20:30 Uhr”.
    On the other hand I have to display the time. Without showing the day and the month. For example to display day/month at the top of the page and the start time at the foot.

    #1222632
    Nico
    Member

    Thanks for following up Norbert!

    …sorry, but I don’t know what filter means…

    No problem! You can find more information about filters & actions here → http://blog.teamtreehouse.com/hooks-wordpress-actions-filters-examples

    My requirement is to display the date. Without time. That means the day and the month like “18. January” and nothing else. Your suggestion tribe_get_start_date displays “18. January 20:30 Uhr”. On the other hand I have to display the time. Without showing the day and the month. For example to display day/month at the top of the page and the start time at the foot.

    Both functions tribe_get_start_date and tribe_get_end_date, accept a date format parameter (more details on the PHP date format). So for example you can the functions this way to get your desired result:

    // get just the date
    echo tribe_get_start_time ( $event_id, 'd. F');

    // get just the time
    echo tribe_get_start_time ( $event_id, 'H:i');

    The first parameter of the function is the event ID. You can pass ‘null’ and the function will try to figure out the value.

    One last thing please note you can also change how dates are displayed in ‘WP-Admin > Events > Settings > Display > Date Format Settings’. This won’t help you with the requirement you mentioned but might help with general formatting across the site!

    Please let me know if this helps,
    Best,
    Nico

    #1222899
    Norbert
    Participant

    Nico, thank you, this works perfect!!! And thanks for the tip! I will break in filtering so I won’t bother you with such stuff 😉 maybe …

    #1222968
    Nico
    Member

    Stoked to hear Norbert 🙂

    No problem, just reach out when you need help. But learning a bit about filters and actions will surely payoff! It’s the base of WordPress!

    I’ll go ahead and close out this thread.

    Have a great a week,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Single Event Date/Time’ is closed to new replies.