Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ladybug/dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def from_date_time_string(cls, datetime_string, leap_year=False):
dt = DateTime.from_date_time_string("31 Dec 12:00")
"""
try:
dt = datetime.strptime(datetime_string, '%d %b %H:%M')
dt = datetime.strptime('2016-{}'.format(datetime_string), '%Y-%d %b %H:%M')
except AttributeError: # older Python version before strptime
vals = datetime_string.split(' ')
tim = vals[-1].split(':')
Expand Down Expand Up @@ -397,7 +397,7 @@ def from_date_string(cls, date_string, leap_year=False):
dt = Date.from_date_string("31 Dec")
"""
try:
dt = datetime.strptime(date_string, '%d %b')
dt = datetime.strptime('2016-{}'.format(date_string), '%Y-%d %b')
except AttributeError: # older Python version before strptime
vals = date_string.split(' ')
dt = datetime(2016, MONTHNAMES.index(vals[1]) + 1, int(vals[0]))
Expand Down
Loading