WP_Privacy_Requests_Table::get_timestamp_as_date( int $timestamp )

Convert timestamp for display.


Description Description


Parameters Parameters

$timestamp

(int) (Required) Event timestamp.


Top ↑

Return Return

(string) Human readable date.


Top ↑

Source Source

File: wp-admin/includes/user.php

	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: human readable timestamp */
			return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
		}

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

Top ↑

Changelog Changelog

Changelog
Version Description
4.9.6 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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