Skip to content

Instantly share code, notes, and snippets.

@thomo
Created March 30, 2018 08:45
Show Gist options
  • Save thomo/0068bf8e881fa88a778fdf8dae9c8e6c to your computer and use it in GitHub Desktop.
Save thomo/0068bf8e881fa88a778fdf8dae9c8e6c to your computer and use it in GitHub Desktop.
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