Title: Custom Date range.
Last modified: August 20, 2016

---

# Custom Date range.

 *  [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/)
 * My client insist that each event be posted by month, However I don’t think I 
   understand how the custom date range works. As this is supposed to pull event
   only for January, yet I get feb dates.
 *     ```
       <?php
   
       global $post;
       $current_date = date('1-01-2013');
       $end_date = date('1-31-2013');
   
       $get_posts = tribe_get_events(array('start_date'=>$current_date,'end_date'=>$end_date,'posts_per_page'=>10) );
   
       foreach($get_posts as $post) { setup_postdata($post); ?>
       <div class="rg-events-loop">
       <div class="rg-events-date"><?php echo tribe_get_start_date($post->ID, false, 'F j, Y'); ?></div>
       <div class="rg-events-title"><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
       </div>
       <div class="rg-events-meta-list">
       		<ul>
       	        <?php if( tribe_address_exists( get_the_ID() ) ) {echo '<li>' . tribe_get_full_address( get_the_ID() ) .'</li>';} ?>
       			<?php if($cfs->get('host')){echo '<li>' . $cfs->get('host') . '</li>';}?>
       			<?php if($cfs->get('event_url')){echo '<li><a href="' . $cfs->get('event_url') .'">'. $cfs->get('event_url') .'</a></li>';}?>
       	   </ul>
       	  </div>
       <?php } //endforeach ?>
       <?php wp_reset_query(); ?>
       ```
   
 * [http://wordpress.org/extend/plugins/the-events-calendar/](http://wordpress.org/extend/plugins/the-events-calendar/)

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

 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3476980)
 * Anybody? It should be easy to point me in the right direction. Thanks
 *  [Rob La Gatta](https://wordpress.org/support/users/roblagatta/)
 * (@roblagatta)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477033)
 * Hey rgfxnet. Thanks for the note here; totally, we should be able to point you
   in the right direction on this end. Let me get Jonah from the team to take a 
   look here and respond directly – expect a response on that end over the next 
   24 hours. Thanks for your patience so far.
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477035)
 * Hey rgfxnet,
 * I think the problem is the dates you’re providing are not in the right format.
   Try using this format instead:
 *     ```
       $current_date = date('Y-m-d H:i:s', strtotime('now'));
       $end_date = date('Y-m-d H:i:s', strtotime('+5 months'));
       ```
   
 * I hope that helps!
 * – Jonah
 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477037)
 * I need a specific date range. Not for now till the next 5 months. The client 
   wants me to have list as so.
 * Jan
 * event 1
    event 2
 * Feb
 * event 1
    event 2
 * March
 * and so on.
 * Thanks for the response, hope to hear from you soon .
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477038)
 * Hey rgfxnet,
 * If you only need one month just change ‘+5 months’ to ‘+1 month’.
 * Cheers,
    Jonah
 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477039)
 * Right, but doesn’t that start from now, not a specific date that I can assign?
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477040)
 * $current_date starts from now. Yes, you can also specify a hard coded range, 
   it just needs to be in that ‘Y-m-d H:i:s’ format.
 * – Jonah
 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477041)
 * Which be as so correct? 01/22/2012 12:00:00
 * Thanks.
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477042)
 * Nope, it would be like: ‘2012-01-22 12:00:00’
 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477045)
 * still seem to be getting issues, but closer. Here is my code, I tried many combinations.
 *     ```
       <h1>Jan</h1>
       <?php
   
       global $post;
       $current_date = date('2013-01-01 00:00:01');
       $end_date = date(strtotime('2013-01-31 23:59:59'));
       $get_posts = tribe_get_events(array('start_date'=>$current_date,'end_date'=>$end_date,'posts_per_page'=>10) );
   
       foreach($get_posts as $post) { setup_postdata($post); ?>
       <div class="rg-events-loop">
       <div class="rg-events-date"><?php echo tribe_get_start_date($post->ID, false, 'F j, Y'); ?></div>
       <div class="rg-events-title"><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
       </div>
       <div class="rg-events-meta-list">
       		<ul class="meta-list">
       	        <?php if( tribe_address_exists( get_the_ID() ) ) {echo '<li>' . tribe_get_full_address( get_the_ID() ) .'</li>';} ?>
       			<?php if($cfs->get('host')){echo '<li>' . $cfs->get('host') . '</li>';}?>
       			<?php if($cfs->get('event_url')){echo '<li><a href="javascript:void()" onclick="window.open(\'' . $cfs->get('event_url') .'\',\'mywindow\',\'height=600, width=800,location=no,scrollbars=yes,left=\' + (screen.width - 800) / 2 + \',top=\' + (screen.height - 600) /2);">Event Url</a></li>';}?>
       	   </ul>
       	  </div>
       <?php } //endforeach ?>
       <?php wp_reset_query(); ?>
       ```
   
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477069)
 * Hey rgfxnet,
 * Sorry for the delay in getting back to you. I’m not sure why this is not working
   correctly so I’m having a developer take a look. Stay tuned.
 * – Jonah
 *  Thread Starter [rgfxnet](https://wordpress.org/support/users/rgfxnet/)
 * (@rgfxnet)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477077)
 * Jonah,
 * Any word from the developer?
 * Thanks
 *  [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477078)
 * Hi rgfxnet,
 * Unfortunately not yet, but I’m going to check in with the developer again and
   see where this is at. Stay tuned.
 * Thanks,
    Jonah

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

The topic ‘Custom Date range.’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 13 replies
 * 3 participants
 * Last reply from: [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/custom-date-range-1/#post-3477078)
 * Status: not resolved