Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Created June 29, 2012 10:17
Show Gist options
  • Save toshimaru/3017096 to your computer and use it in GitHub Desktop.
Save toshimaru/3017096 to your computer and use it in GitHub Desktop.
php checktime function
<?php
function checktime($hour, $min, $sec) {
if ($hour < 0 || $hour > 23 || !is_numeric($hour)) {
return false;
}
if ($min < 0 || $min > 59 || !is_numeric($min)) {
return false;
}
if ($sec < 0 || $sec > 59 || !is_numeric($sec)) {
return false;
}
return true;
}
@glitcha
Copy link

glitcha commented Dec 11, 2014

This is really handy thanks!

@gromovjm
Copy link

gromovjm commented Oct 7, 2017

Thank you!..

@agarb7
Copy link

agarb7 commented May 24, 2018

Handy for some purposes, but it not aware of leap second

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment