h = (h < 10) ? "0" + h : h; code example Example: h = (h < 10) ? "0" + h : h; h = (h < 10) ? "0" + h : h;