LLMS_Abstract_Notification_View::get_date_display( int $max_days = 5 )
Get relative or absolute date
Description Description
Returns relative if relative date is less than $max_days otherwise returns the absolute date.
Parameters Parameters
- $max_days
-
(int) (Optional) Max age of notification to display relative date for.
Default value: 5
Return Return
(string)
Source Source
File: includes/abstracts/llms.abstract.notification.view.php
public function get_date_display( $max_days = 5 ) { $now = current_time( 'timestamp' ); $created = $this->get_date( 'created', 'U' ); if ( ( $now - $created ) <= ( $max_days * DAY_IN_SECONDS ) ) { return sprintf( _x( 'About %s ago', 'relative date display', 'lifterlms' ), $this->get_date_relative( 'created' ) ); } return $this->get_date( 'created' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | Introduced. |