Title: Start Date
Last modified: August 22, 2016

---

# Start Date

 *  Resolved [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/)
 * Hi,
 * I am using this calendar to run a website that uses posts to show events. The
   site currently shows a list of events, but I need to use the calendars start 
   and end date to display in the event list. Is there a function that I could call
   in the loop to display the start and end date that was entered in the calendar
   during creating the post?
 * [https://wordpress.org/plugins/jm-wp-posts-calendar/](https://wordpress.org/plugins/jm-wp-posts-calendar/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482066)
 * Hi,
 * You should be able to get the start and end dates by using the get_post_meta 
   function within your loop.
 * [get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)
 * The keys used are ‘_jm_calendar_event_start’ & ‘_jm_calendar_event_end’
 *  Thread Starter [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482067)
 * Thank you for your response.
 * So, does that mean this line of code should return the start date:
 * <?php echo get_post_meta(‘_jm_calendar_event_start’); ?>
 * Because I must be missing something because it doesn’t return anything.
 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482096)
 * You need to pass the post id as the first parameter.
 *  Thread Starter [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482101)
 * OK, I’m obviously doing something wrong here, although I am slightly closer I
   think, I’ve used:
 * <?php echo get_post_meta($post->ID, ‘_jm_calendar_event_start’); ?>
 * This however, just returns the word “ARRAY” on the page.
    I think I may not be
   using this correctly, so here is my code from the start of the content, so would
   you be able to tell me what I’m doing wrong so that I can get the Start/End date
   returned? Currently, I’m just trying to Start date in this code, but I do need
   both.
 * <?php
    $my_query = new WP_Query(‘post_status=future&order=ASC’); while ($my_query-
   >have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
 * <div class = “row”>
    <div class = “col-md-2 col-buffer”> <?php if ( has_post_thumbnail()){?
   > ” title=”<?php the_title_attribute(); ?>”> <?php the_post_thumbnail(‘post-thumbnail’,
   array( ‘class’ => “img img-responsive pull-center”)); ?>  <?php } else { ?> ”
   title=”<?php the_title_attribute(); ?>”> <img class = “img img-responsive pull-
   center” src=”<?php echo get_template_directory_uri(); ?>/images/logo.png” /><?
   php } ?> </div> <div class = “col-md-10”> <h2>” rel=”bookmark” title=”Permanent
   Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
 *  <h3><?php echo get_post_meta($post->ID, ‘_jm_calendar_event_start’); ?></h3>
 *  <?php the_excerpt(); ?>
    </div> </div>
 * <?php endwhile;?>
 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482103)
 * If you add ‘true’ (no quotes) as the third parameter and you should get the result
   you are looking for.
 * **Example:**
    <h3><?php echo get_post_meta($post->ID, ‘_jm_calendar_event_start’,
   true); ?></h3>
 *  Thread Starter [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482108)
 * That’s great, that has worked.
 * Sorry to bother you further, but is there a way that I can change the format 
   that this displays?
    At the moment, the date/time echoes out as 2014-12-24 00:
   00, is there a way I can change this to display like Saturday 24th Dec, 12:00am?
 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482151)
 * Try something like this,
 * <h3><?php echo date(‘l dS \o\f F Y h:i:s A’, get_post_meta($post->ID, ‘_jm_calendar_event_start’,
   true)); ?></h3>
 *  Thread Starter [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482155)
 * Thanks again for your response to this issue.
 * I tried that, and the result was that it shows the same date, no matter what,
   which is:
 * Thursday 01st of January 1970 12:33:34 AM
 * Although there doesn’t seem to be, is there something in that code which is specifying
   this date/time? The result isn’t related to the start date of the event, or even
   the published date of the post (thought I’d double check that too as it’s the
   only other place a date/time value is located). What could be casuing this?
 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482163)
 * Hi,
 * Try this instead. I have tested it here and it gives me the format you are looking
   for.
 * <h3><?php echo date(‘l jS M Y h:i:s A’,strtotime(get_post_meta($post->ID, ‘_jm_calendar_event_start’,
   true))); ?></h3>
 *  Thread Starter [steve_eh](https://wordpress.org/support/users/steve_eh/)
 * (@steve_eh)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482165)
 * Perfect, that’s brilliant.
 * Thanks for your responses, I’ve previously had very little luck in getting responses
   to my enquiries, but you’ve been great!
 *  Plugin Author [JMDS](https://wordpress.org/support/users/jmds/)
 * (@jmds)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482166)
 * Glad to have been able to help on this occasion.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Start Date’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/jm-wp-posts-calendar_f8f8f8.svg)
 * [WP Posts Calendar](https://wordpress.org/plugins/jm-wp-posts-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jm-wp-posts-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jm-wp-posts-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/jm-wp-posts-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jm-wp-posts-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jm-wp-posts-calendar/reviews/)

## Tags

 * [calendar](https://wordpress.org/support/topic-tag/calendar/)
 * [date](https://wordpress.org/support/topic-tag/date/)
 * [end](https://wordpress.org/support/topic-tag/end/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * 11 replies
 * 2 participants
 * Last reply from: [JMDS](https://wordpress.org/support/users/jmds/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/start-date/#post-5482166)
 * Status: resolved