# format

> Format query output from a `select` statement.

> ### For an overview see page Miscellaneous SQL Functions

> ### Prototype

>         format( fmt, val);

> ### Arguments

> fmt | The format string
> val | The value to be formatted

> ### Description

> > This function formats the value `val` according to the format specified by the format string `fmt`. If val is of type `datetime`, then `fmt` must be a string suitable for `strftime()`. For numeric and string values `fmt` must be a string suitable for `printf()`. Values of other types are converted to string. (Note that the format string must be enclosed in single quotes.)

> ### Example

>         create table t(c char);
>         insert into t(c) values('comment');

>         select c, format('A parenthetic (%s :)', c) from t;
>         c #2
>         -----------------------------------------------------
>         comment (A parenthetic comment :)