Created
March 25, 2018 05:10
-
-
Save prateekiiest/6ec311d7969fc5329af24ff7752305e6 to your computer and use it in GitHub Desktop.
Enhancement for Handling Date inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_time(time_string, time_format='', **kwargs): | |
if isinstance(time_string, date): | |
dat = (''.join("{}-" for i in range(len(time_string.timetuple()[0:3])))).rstrip('-') | |
return T.Time(dat.format(*time_string.timetuple()[0:3]) + " " + datetime.time().isoformat()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment