Skip to content

Commit 23fc6a5

Browse files
authored
Merge pull request #48 from vinraspa/dev
Update xlsw.py
2 parents 26b665c + 473ee14 commit 23fc6a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyexcel_xls/xlsw.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ def write_row(self, array):
5252
value = xlrd.xldate.xldate_from_datetime_tuple(tmp_array, 0)
5353
style = XFStyle()
5454
style.num_format_str = DEFAULT_DATETIME_FORMAT
55+
elif isinstance(value, datetime.timedelta):
56+
hours = value.days * 24 + value.seconds // 3600
57+
minutes = (value.seconds // 60) % 60
58+
seconds = value.seconds % 60
59+
tmp_array = [hours, minutes, seconds]
60+
value = xlrd.xldate.xldate_from_time_tuple(tmp_array)
61+
style = XFStyle()
62+
style.num_format_str = DEFAULT_TIME_FORMAT
5563
elif isinstance(value, datetime.date):
5664
tmp_array = [value.year, value.month, value.day]
5765
value = xlrd.xldate.xldate_from_date_tuple(tmp_array, 0)

0 commit comments

Comments
 (0)