bbp_convert_date

Convert time supplied from database query into specified date format.

Description

(string) bbp_convert_date( (int|object) $time, (string) $d = 'U', (bool) $translate = false ); 

Returns (string)

Returns timestamp

Parameters (3)

0. $time — Optional. (int|object)
Default is global post object. A post_id or post object
1. $d — Optional. (string) => 'U'
Default is U.. Either G,, U., or php date format
2. $translate — Optional. (bool) => false
Default is false. Whether to translate the result

Usage

  1. if ( !function_exists( 'bbp_convert_date' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/functions.php'; 
  3.  
  4. // Optional. Default is global post object. A post_id or 
  5. // post object 
  6. $time = null; 
  7.  
  8. // Optional. Default is 'U'. Either 'G', 'U', or php date 
  9. // format 
  10. $d = 'U'; 
  11.  
  12. // Optional. Default is false. Whether to translate the 
  13. // result 
  14. $translate = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bbp_convert_date($time, $d, $translate); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/common/functions.php  
  1. function bbp_convert_date( $time, $d = 'U', $translate = false ) { 
  2. $time = mysql2date( $d, $time, $translate ); 
  3.  
  4. return apply_filters( 'bbp_convert_date', $time, $d, $translate );