i think the format in that code may not return what you need if the values have leading zeros
try replacing the last part with
"0##\-0##\-0##"