DateTime issues in django xlsxwriter

微笑、不失礼 提交于 2019-12-01 08:20:08

Excel, and thus XlsxWriter, doesn't support timezones in dates/times.

So you will need to remove or adjust the timezone from the datetime before passing it to XlsxWriter.

Something like this from the pytz docs:

dt = datetime(2005, 3, 1, 14, 13, 21, tzinfo=utc)
naive = dt.replace(tzinfo=None)

Probably this would be better handled in Django though rather than adjusting all datetime data prior to passing it to XlsxWriter. Maybe someone else can add a suggestion on that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!