WP_Privacy_Requests_Table::get_timestamp_as_date()
Converts a timestamp for display.
Method of the class: WP_Privacy_Requests_Table{}
No Hooks.
Return
String
. Human readable date.
Usage
// protected - for code of main (parent) or child class $result = $this->get_timestamp_as_date( $timestamp );
- $timestamp(int) (required)
- Event timestamp.
Changelog
Since 4.9.6 | Introduced. |
WP_Privacy_Requests_Table::get_timestamp_as_date() WP Privacy Requests Table::get timestamp as date code WP 6.8
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 ); }