Aleksander Machniak
2015-06-26 9aae1b7fc399b5d2cecb8f0d0df6a2ae4e749786
program/lib/Roundcube/rcube_utils.php
@@ -1149,4 +1149,27 @@
        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);
    }
}