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
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | 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. |