Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Small function to verify validity of datetime (to use with https://gist.github.com/thomo/8ac2bceb6400eb8868c651e8897be958)
function isDateTimeValid(second, minute, hour, day, month, year)
function check(x, xmin, xmax)
return x >= xmin and x <= xmax
end
return check(second, 0, 59) and check(minute, 0, 59) and check(hour, 0, 23) and
check(day, 1, 31) and check(month, 1, 12) and check(year, 0, 99)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment