wppaste
WordPress

WP_Privacy_Requests_Table::get_timestamp_as_date( int $timestamp ): string

Since
4.9.6
Source
wp-admin/includes/class-wp-privacy-requests-table.php:479
Converts a timestamp for display.

Parameters

$timestampint
Event timestamp.

Return

string
Human readable date.

Uses · 3

  • __()Retrieves the translation of $text.
  • human_time_diff()Determines the difference between two timestamps.
  • date_i18n()Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds.

Used by · 2

Source

	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 sprintf(			/* translators: 1: privacy request date format, 2: privacy request time format. */			__( '%1$s at %2$s' ),			/* translators: privacy request date format. See https://www.php.net/manual/en/datetime.format.php */			date_i18n( __( 'Y/m/d' ), $timestamp ),			/* translators: privacy request time format. See https://www.php.net/manual/en/datetime.format.php */			date_i18n( __( 'g:i a' ), $timestamp )		);	}

History

Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-admin/includes/class-wp-privacy-requests-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.