$last_stat_date = $this->getLastStatDate( 'weekly' );
if ( $last_stat_date != self::STAT_START_DATE ) {
$stat_date = new DateTime( $last_stat_date );
- $stat_date->modify( '+ 2 week' );
+ $stat_date->modify( '+ 1 week' );
$last_stat_date = $stat_date->format( 'Y-m-d' );
}
+ $current_date = new DateTime();
+ $current_date->modify( '+ 2 weeks' );
$results = $this->wpdb->get_results(
$this->wpdb->prepare(
"SELECT count(id) as leads_count,DATE_FORMAT(date_submitted, '%%Y%%U') as weekly
WHERE date_submitted < %s
AND date_submitted > %s
GROUP BY weekly",
- current_time( 'Y-m-d' ),
+ $current_date->format( 'Y-m-d' ),
$last_stat_date
),
ARRAY_A
$last_stat_date = $this->getLastStatDate( 'monthly' );
if ( $last_stat_date != self::STAT_START_DATE ) {
$stat_date = new DateTime( $last_stat_date );
- $stat_date->modify( '+ 2 month' );
+ $stat_date->modify( '+ 1 month' );
$last_stat_date = $stat_date->format( 'Y-m-d' );
}
+ $current_date = new DateTime();
+ $current_date->modify( '+ 2 months' );
$sql = "
SELECT count(id) as leads_count,DATE_FORMAT(date_submitted, '%Y%m') as monthly
FROM " . GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX . "lead_entry
WHERE date_submitted < %s
AND date_submitted > %s
GROUP BY monthly",
- current_time( 'Y-m-d' ),
+ $current_date->format( 'Y-m-d' ),
$last_stat_date
),
ARRAY_A