WordPress at Your Fingertips
function is not described

WP_Privacy_Requests_Table::get_timestamp_as_date() protected WP 4.9.6

Convert timestamp for display.

{} It's a method of the class: WP_Privacy_Requests_Table{}

No Hooks.

Return

String. Human readable date.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_timestamp_as_date( $timestamp );
$timestamp(int) (required)
Event timestamp.

Changelog

Since 4.9.6 Introduced.

Code of WP_Privacy_Requests_Table::get_timestamp_as_date() WP 5.8.2

protected function get_timestamp_as_date( $timestamp ) {
	if ( empty( $timestamp ) ) {
		return '';
	}

	$time_diff = time() - $timestamp;

	if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
		/* translators: %s: Human-readable time difference. */
		return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
	}

	return date_i18n( get_option( 'date_format' ), $timestamp );
}