Search code examples
djangoxlwt

exporting datetime to excel in django using xlwt


I am exporting data to excel(.xls) in django using xlwt module but datetime is exporting in this 43239.6389467593 format. I dont know what is this format and how to change it to datetime in excel sheet. I followed the following

https://simpleisbetterthancomplex.com/tutorial/2016/07/29/how-to-export-to-excel.html


Solution

  • This is a numerical representation of the date value. If you don't want to change the export code on django you can fix the issue within Excel. If you have an entry like this in cell A1 for example then set Cell B1 =A1 and change the format of the cell B1 to the Dateformat you want. It should then appear as a normal date.

    enter image description here