Skip to content

Instantly share code, notes, and snippets.

@TheTrafficNetwork
TheTrafficNetwork / UserDateInput.py
Last active December 27, 2018 19:10
User Date Input Function
#!/usr/bin/env python
from datetime import datetime
def UserDateInput(): #Define function named UserDateInput reuqesting the user to input two dates. Checks to see if inputs are in correct format of yyyy-mm-dd. Also checks to make sure the starting date is before the ending date.
CorrectStartEnd = False #Defines variable to reference in following loop
while CorrectStartEnd == False: #Loop until End date is after Start date
Correct_Dformat1 = False #Defines variable for first date following loop
while Correct_Dformat1 == False: #Loop until formatting of StartDate_Request is correct