LLMS_Analytics_Widget::format_date( $date, $type )
Contents
Source Source
File: includes/abstracts/abstract.llms.analytics.widget.php
protected function format_date( $date, $type ) {
switch ( $type ) {
case 'start':
$date .= ' 00:00:00';
break;
case 'end':
/**
* Return 00:00:00 on the next day after this date, using PHP datetime functions to avoid issues with daylight savings time or leap years.
*
* 23:59:59 is not a safe way to capture the end of day in newer versions of MySQL, if the transaction happened at (say) 23:59:59.999.
*/
$end_date = new DateTime( $date );
$end_date->modify( '+1 day' );
$date = $end_date->format( 'Y-m-d' ) . ' 00:00:00';
break;
}
return $date;
}
Expand full source code Collapse full source code View on GitHub