This is another way to check the time format instead of this one.
<?php
function check_time_format($time)
{
$valid = false;
if (preg_match('/(\d\d):(\d\d):(\d\d)/', $time))
{
$valid = true;
}
return $valid;
}
?>
Example
<?php
$time = '23:35:58';
function check_time_format($time)
{
$valid = false;
if (preg_match('/(\d\d):(\d\d):(\d\d)/', $time))
{
$valid = true;
}
return $valid;
}
if (check_time_format($time))
{
echo 'valid';
}
else
{
echo 'not valid';
}
?>
Mail this!
- Comments (0)
- PingBacks (0)
- TrackBacks (0)


» Latest comments