Add method convert a number according to the format specified