From 4b59fa4b39d0a34f02432cf9bbd1e06ab30fe098 Mon Sep 17 00:00:00 2001 From: Carlos Javier Prados Hijon Date: Wed, 22 Jun 2016 20:56:18 +0200 Subject: [PATCH] Bug fix in to_unix conversion Added conversion to datetime type and then to unix time --- stringutilities.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stringutilities.py b/stringutilities.py index 87d60fb..2fd282f 100644 --- a/stringutilities.py +++ b/stringutilities.py @@ -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