Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 47.1Mb
PDF (A4) - 47.2Mb
PDF (RPM) - 42.7Mb
HTML Download (TGZ) - 10.8Mb
HTML Download (Zip) - 10.9Mb
HTML Download (RPM) - 9.4Mb
Man Pages (TGZ) - 227.7Kb
Man Pages (Zip) - 333.6Kb
Info (Gzip) - 4.2Mb
Info (Zip) - 4.2Mb
Excerpts from this Manual

27.4.5.6 The format_time() Function

Note

As of MySQL 8.0.16, format_time() is deprecated and will be removed in a future MySQL version. Applications that use it should be migrated to use the built-in FORMAT_PICO_TIME() function instead. See Section 12.22, “Performance Schema Functions”

Given a Performance Schema latency or wait time in picoseconds, converts it to human-readable format and returns a string consisting of a value and a units indicator. Depending on the size of the value, the units part is ps (nanoseconds), ns (nanoseconds), us (microseconds), ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), or w (weeks).

Parameters
  • picoseconds TEXT: The picoseconds value to format.

Return Value

A TEXT value.

Example
mysql> SELECT sys.format_time(3501), sys.format_time(188732396662000);
+-----------------------+----------------------------------+
| sys.format_time(3501) | sys.format_time(188732396662000) |
+-----------------------+----------------------------------+
| 3.50 ns               | 3.15 m                           |
+-----------------------+----------------------------------+