title: How do I validate a date and time in string format in python?
body: <p>I have seen many validating Date or Time in python, however I have not been able to figure out both! (i.e '%Y-%m-%d' or '%H:%M:%S'). I would like it in the format yyyy-mm-dd 1:30:00 as the import datetime gives. Is there a way to utilize both? Could someone please help me with verifying this input? I keep getting an infinite loop!</p>
  <pre><code>timeflight = input(&quot;when is the flight? Enter Exactly as (time is in military): yyyy-mm-dd 
  1:30:00 --&gt; &quot;)
  while True:
     if timeflight is not format('%Y-%m-%d %H:%M:%S'):
        print( &quot;please put into the correct format yyyy-mm-dd 1:30:00 &quot;)
        timeflight = input()
  </code></pre>
  <p>THANKS</p>