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:478
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
- WP_Privacy_Requests_Table::column_created_timestamp()Returns the markup for the Created timestamp column. Overridden by children.
- WP_Privacy_Requests_Table::column_status()Status column.
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.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 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.