pmpro_isDateThisMonth

Does the date provided fall in this month.

Description

pmpro_isDateThisMonth( $str ); 

Used in logins/visits/views report.

Parameters (1)

0. $str
The str.

Usage

  1. if ( !function_exists( 'pmpro_isDateThisMonth' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4. // The str. 
  5. $str = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pmpro_isDateThisMonth($str); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function pmpro_isDateThisMonth($str) 
  2. $now = current_time('timestamp'); 
  3. $this_month = intval(date_i18n("n", $now)); 
  4. $this_year = intval(date_i18n("Y", $now)); 
  5.  
  6. $date = strtotime($str, $now); 
  7. $date_month = intval(date_i18n("n", $date)); 
  8. $date_year = intval(date_i18n("Y", $date)); 
  9.  
  10. if($date_month === $this_month && $date_year === $this_year) 
  11. return true; 
  12. else 
  13. return false;