LLMS_Admin_Reporting::get_dates( string $range )
Get dates via the current date string.
Parameters Parameters
- $range
-
(string) (Required) Date range string.
Return Return
(array)
Source Source
File: includes/admin/reporting/class.llms.admin.reporting.php
public static function get_dates( $range ) {
$now = current_time( 'timestamp' );
$dates = array(
'start' => '',
'end' => date( 'Y-m-d', $now ),
);
switch ( $range ) {
case 'this-year':
$dates['start'] = date( 'Y', $now ) . '-01-01';
break;
case 'last-month':
$dates['start'] = date( 'Y-m-d', strtotime( 'first day of last month', $now ) );
$dates['end'] = date( 'Y-m-d', strtotime( 'last day of last month', $now ) );
break;
case 'this-month':
$dates['start'] = date( 'Y-m', $now ) . '-01';
break;
case 'last-7-days':
$dates['start'] = date( 'Y-m-d', strtotime( '-7 days', $now ) );
break;
case 'custom':
$dates['start'] = self::get_date_start();
$dates['end'] = self::get_date_end();
break;
}
return $dates;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |