input time as string js code example Example: h = (h < 10) ? "0" + h : h; h = (h < 10) ? "0" + h : h;