Skip to content

Commit

Permalink
Bug fix in to_unix conversion
Browse files Browse the repository at this point in the history
Added conversion to datetime type and then to unix time
  • Loading branch information
carlosprados authored Jun 22, 2016
1 parent 17ede15 commit 4b59fa4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stringutilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ def from_unix(self, timestamp):
def to_unix(self, timestr):
sublime.status_message('Convert from human readable date to epoch.')
try:
return '%d' % (time.mktime(timestr.timetuple()))
datetime_to_convert = datetime.strptime(timestr, "%Y-%m-%d %H:%M")
return '%d' % (time.mktime(datetime_to_convert.timetuple()))
except:
return False

Expand Down

0 comments on commit 4b59fa4

Please sign in to comment.