|
|
|
@ -1149,4 +1149,27 @@ class rcube_utils
|
|
|
|
|
|
|
|
|
|
return $random;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Format current date according to specified format.
|
|
|
|
|
* This method supports microseconds (u).
|
|
|
|
|
*
|
|
|
|
|
* @param string $format Date format (default: 'd-M-Y H:i:s O')
|
|
|
|
|
*
|
|
|
|
|
* @return string Formatted date
|
|
|
|
|
*/
|
|
|
|
|
public static function date_format($format = null)
|
|
|
|
|
{
|
|
|
|
|
if (empty($format)) {
|
|
|
|
|
$format = 'd-M-Y H:i:s O';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strpos($format, 'u') !== false
|
|
|
|
|
&& ($date = date_create_from_format('U.u.e', microtime(true) . '.' . date_default_timezone_get()))
|
|
|
|
|
) {
|
|
|
|
|
return $date->format($format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return date($format);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|