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.


Top ↑

Parameters Parameters

$max_days

(int) (Optional) Max age of notification to display relative date for.

Default value: 5


Top ↑

Return Return

(string)


Top ↑

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' );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.