Display time without the date

Home Forums Calendar Products Events Calendar PRO Display time without the date

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28938
    Darius
    Participant

    So I did some poking around trying to see how I can output just the start time and end time for an event but my efforts have been fruitless. Is the solution in the tribe-date-utils.class.php file? There seems to be some code in there relating to just the time. The Template tags, tribe_get_end_date and tribe_get_start_date seem to be pre-configured to always show the date. Is it possible to just output the time?

    #28939
    Barry
    Member

    Yes there is.

    Most or all of our date-related template tags accept an optional date format parameter, which is basically just the same as accepted by PHP’s date function:

    tribe_get_end_date(null, false, 'H:i:s')

    Or you can tell it to display the time (and therefore adopt the same format as used elsewhere in your blog) and pass a blank format:

    echo tribe_get_end_date(null, true, ' ');

    Note that an empty string ” won’t work here, you need at least one character of whitespace.

    #28940
    Barry
    Member

    Woops, forgot the echo keyword in the first example, but I’m sure you get the idea.

    #28946
    Darius
    Participant

    Yes, I got the idea – I had actually tried that option but I didn’t put the white space so it didn’t work for me. Funny how small things make such a big difference!

    #28947
    Darius
    Participant

    Thanks!

    #28953
    Barry
    Member

    No problem – the devil’s definitely in the detail – glad you’re all sorted here 🙂

    #978275
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Display time without the date’ is closed to new replies.