• I’ve never been a fan of how these event calendars all seem to display the time like:
    Start: December 18, 2010 7:30 pm
    End: December 18, 2010 11:00 pm

    I’d like to be able to just have it say:
    December 18, 2010 7:30 pm – 11:00 pm

    I can figure out how to change everything I need except how to display just the end time without the whole date in front of it. I’m assuming I need to manipulate the variable the_event_end_date( $id, $showtime, $dateFormat), but I’m not sure how. I did a Hail Mary where I tried using the_event_end_date( $showtime), thinking maybe it would just display the time that way, but unsurprisingly that didn’t work.

    Can anybody who actually knows what they’re doing tell me how to change it? ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • Jesus, I’m in the same boat!! nobody needs to see the date twice. Ever.
    If you find a solution, I would be interested to hear it.
    K

    This is what I got so far. It looks like this:
    Date: December 24, 7:00 pm
    – 8:00 pm

    I edited two files: (1) template-tags.php in the plugin folder and (2) single.php in the views folder.

    template-tags.php
    Look for the function that “Returns the event end date.” I put in the HTML entity for an en dash (which needs to be put in hex form). That was the function knows it’s not supposed to use the default date format, but has no date format to use in its place, hence the en dash.

    function the_event_end_date( $postId = null, $showtime = 'true', $dateFormat = '–' ) {

    single.php
    If you edit files in the views folder, the readme file recommends copying those files into your theme in an “events” folder.
    I commented out the code for the End Date. And placed the call to the_event_end_date() right next to the the_event_start_date().

    <dt><?php _e('Date:', $spEvents->pluginDomain) ?></dt>
    <dd><?php echo the_event_start_date('','true','F j,'); ?>
    <?php if (the_event_start_date() !== the_event_end_date() ) { ?><?php echo the_event_end_date();  ?><?php } ?></dd>

    You can see on my example that, It changed the symmetry of the columns so I did some other html editing.

    Hey,

    It’s really simple
    Go to list.php, single.php or wherever you want to display the time, and use functions the_event_start_date end the_event_end_date with your own parameters:

    example:
    <?php echo the_event_start_date(null,FALSE,’G:i’); ?> – <?php echo the_event_end_date(null,FALSE,’G:i’); ?>

    result:
    8:00 – 15:00

    Cheers!

    @lukio Agh!! You’re amazing! Thanks!

    My code looks like this:

    <?php echo the_event_start_date('','',''); ?>
    <?php if (the_event_start_date('','','') !== the_event_end_date('','','') ) { ?>
    <?php echo the_event_end_date('','','');  ?>
    <?php } ?>
    <?php if (the_event_start_date(null,FALSE,'G:i') !== ('0:00') ) { ?> |
    <?php echo the_event_start_date(null,FALSE,'G:i'); ?> -
    <?php echo the_event_end_date(null,FALSE,'G:i'); ?>
    
    <?php } ?>

    Thanks you all!

    I wonder how I should edit the code to do the same in the widget?
    The code in “events-list-load-widget-display.php” looks like this:

    <?php
    			if ( $start == 'on' && $EventStartDate != '' ) {
    				$time = $startTime == 'on' ? true : false;
    				echo the_event_start_date( $post->ID, $time );
    			}
    			if ( $end == 'on' && $EventEndDate != '' ) {
    				if( $start == 'on' && $EventStartDate != '' ) echo ' - ';
    				$time = $endTime == 'on' ? true : false;
    				echo the_event_end_date( $post->ID, $time );
    			}
    		?>

    I’ve tried to just replace echo the_event_end_date( $post->ID, $time ); with echo the_event_end_date(null,FALSE,'G:i'); and the format seems right, but the time just shows 0:00.

    Anyone have a clue?

    try changing it to:
    echo the_event_end_date($post->ID, FALSE, 'G:i');

    @monodistortion
    Great! Thanks!

    Hi everybody,
    does someone has an idea if its possible to get it like..
    7. May 2011 to 18. May 2011
    if it is a period (eg. an exhibition) but get it like ..
    7. May 2011
    if it is just a “One-Day”-Event?

    And would you be so kind to tell me the trick ??
    regards
    axel

    I’m looking to do the same thing, bydio, mostly just in the sidebar widget, but throughout would be fine as well… There must be a way to throw an if statement in there that checks if start time is the same as end time and if so, not show the end time.

    How can I translate “months”? ie. March (en) = Marzo (it)

    tnx

    This is great!
    I was wondering if you all could help me out with one more additional step.

    Instead of having a “start time” and then an “end time” in my table, I’d like to have “date” and “time”.

    Ideally, date would either display the single date posted or, for example, “march 3 – march 10”.

    And then the “time” would display as either “all day” or, for example, “3:00pm – 5:00pm”.

    I’m still learning php and can’t figure out how to separate the date-stamp from the time-stamp. Is this possible?

    Any help would be really appreciated!

    This is what I have so far and it’s close. But I’m still missing the am/pm and I can’t figure out how to create an if statement for an all day event. Anybody?

    <?php echo the_event_start_date(null,FALSE); ?> - <?php echo the_event_end_date(null,FALSE);  ?>
    
    <?php echo the_event_start_date(null,FALSE,'h:i'); ?> - <?php echo the_event_end_date(null,FALSE,'h:i'); ?></td>
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: The Events Calendar] How to change start-and-end time display?’ is closed to new replies.