WP_Privacy_Requests_Table::get_timestamp_as_date

Advertisement

Summery Summery

Convert timestamp for display.

Syntax Syntax

WP_Privacy_Requests_Table::get_timestamp_as_date( int $timestamp )

Parameters Parameters

$timestamp

(Required) Event timestamp.

Return Return

(string) Human readable date.

Source Source

File: wp-admin/includes/class-wp-privacy-requests-table.php

	 *
	 * @param int $timestamp Event timestamp.
	 * @return string Human readable date.
	 */
	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 ) );

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.6 Introduced.

Advertisement

Leave a Reply