Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- constructTimeObject = time.gmtime()
- timeObject = constructTimeObject
- year, month, day,\
- hour, minute, second = [
- timeObject[x] for x in range(0,6)
- ]
- date = [year, month, day, hour, minute, second]
- def isValidDate(date):
- if (1900 < date[0] <= date[0]) and \
- (1 <= date[1] <= 12) and \
- (1 <= date[2] <= 31) and \
- (0 <= date[3] < 24) and \
- (0 <= date[4] < 60) and \
- (0 <= date[5] < 60):
- return 1
- result = isValidDate(date)
- if result == 1:
- print("Is a valid date.")
- else:
- print("Is an invalid date.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement