mySql  format function

the mysql format function is used to format how a field is to be displayed.

mysql format() function syntax

         select    format(column_name, format)    from   table_name;
parameterdescription
column_namerequired.the field to be formatted.
formatrequired.specifies the format.

demo database table use in the below mysql format function example

below is a selection from the "users" table:

useridfirstnamelastnamesalarybonus
1sandeepkumar10,0001000
2ankitkumar20,0002000
3ramnehra30,0003000
4vikashnehra12,0002000

mysql format Function example

               
select  firstname,format (now(),'yyyy-mm-dd') as  date    from    users;

output : try it yourself