On this page
WP_Privacy_Requests_Table::get_timestamp_as_date( int $timestamp ): string
Convert timestamp for display.
Parameters
$timestampint Required-
Event timestamp.
Return
string Human readable date.
Source
File: wp-admin/includes/class-wp-privacy-requests-table.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| date_i18n() wp-includes/functions.php | Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds. |
| human_time_diff() wp-includes/formatting.php | Determines the difference between two timestamps. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| WP_Privacy_Requests_Table::column_created_timestamp() wp-admin/includes/class-wp-privacy-requests-table.php | Created timestamp column. Overridden by children. |
| WP_Privacy_Requests_Table::column_status() wp-admin/includes/class-wp-privacy-requests-table.php | Status column. |
Changelog
| Version | Description |
|---|---|
| 4.9.6 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_privacy_requests_table/get_timestamp_as_date