mysql FORMAT() function
Translation results:
UK[ˈfɔ:mæt] US[ˈfɔ:rmæt]
n. (Publication) format; [Auto] (Data arrangement) form; TV program overall arrangement (or plan)
vt. To format; to arrange the pattern of…; to design the layout of…
vi. To design a layout
Third person singular: formats Plural: formats Present participle: formatting Past Formula: formatted Past participle: formatted
mysql FORMAT() functionsyntax
Function:Format the display of fields.
Syntax: SELECT FORMAT(column_name,format) FROM table_name
Parameters:
Parameter | Description |
column_name | Required. The field to format. |
format | Required. Specify the format. |
mysql FORMAT() functionexample
//显示每天日期所对应的名称和价格(日期的显示格式是 "YYYY-MM-DD")。 SELECT ProductName, UnitPrice, FORMAT(Now(),'YYYY-MM-DD') as PerDate FROM Products;