it's not really a problem of sprintf - u first need to detect that the user forgot the colon. Assuming the user has to type in two numbers that (2 digits max) separated by a colon, u could do it like this:
// $time should contain the user input
$parts = explode(":", strval($time));
if(sizeof($parts) < 2))
{
// Missing colon
$time = strval($time);
if(strlen($time) == 3)
{
$time = "0" . $time{0} . ":" .$time{1} . $time{2};
}
else if(strlen($time) == 4)
{
$time = $time{0} . $time{1} . ":" . $time{2} . $time{3};
}
else
{
// Invalid input, notify etc.
$time = "00:00";
}
}
else
{
$time = $parts[0] . ":" . $parts[1];
}
hth