File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 16
16
17
17
DEFAULT_DATE_FORMAT = "DD/MM/YY"
18
18
DEFAULT_TIME_FORMAT = "HH:MM:SS"
19
+ DEFAULT_LONGTIME_FORMAT = "[HH]:MM:SS"
19
20
DEFAULT_DATETIME_FORMAT = "%s %s" % (DEFAULT_DATE_FORMAT , DEFAULT_TIME_FORMAT )
20
21
EMPTY_SHEET_NOT_ALLOWED = "xlwt does not support a book without any sheets"
21
22
@@ -53,13 +54,9 @@ def write_row(self, array):
53
54
style = XFStyle ()
54
55
style .num_format_str = DEFAULT_DATETIME_FORMAT
55
56
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 )
57
+ value = value .days + value .seconds / 86_400
61
58
style = XFStyle ()
62
- style .num_format_str = DEFAULT_TIME_FORMAT
59
+ style .num_format_str = DEFAULT_LONGTIME_FORMAT
63
60
elif isinstance (value , datetime .date ):
64
61
tmp_array = [value .year , value .month , value .day ]
65
62
value = xlrd .xldate .xldate_from_date_tuple (tmp_array , 0 )
You can’t perform that action at this time.
0 commit comments