Index: globals.php =================================================================== --- globals.php (revision 15512) +++ globals.php (working copy) @@ -680,6 +680,7 @@ * @static * @param int $timestamp * @return DateTime + * @access public */ public static function dateFromTimestamp($timestamp) { @@ -694,6 +695,23 @@ return $date; } + + /** + * Returns timestamp from given DateTime class instance + * + * @static + * @param DateTime $date_time + * @return int|string + * @access public + */ + public static function timestampFromDate(DateTime $date_time) + { + if ( version_compare(PHP_VERSION, '5.3.0', '<') ) { + return $date_time->format('U'); + } + + return $date_time->getTimestamp(); + } } /**