New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: default format for dates and times #5

Closed
eazb opened this Issue Mar 27, 2013 · 1 comment

Comments

2 participants
@eazb

eazb commented Mar 27, 2013

Hello John,

First off, thanks again for your efforts.
As discussed, it would be great if default formats for dates and times could be added, so that the user can specify values to be written without making exceptions to provide a format. I find your idea of class methods providing the defaults, which could be overriden if needed. Any format from ISO 8601 would do, e.g., YYYY-MM-DD and hh:mm:ss

Thanks!

Eduardo

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Jul 26, 2013

Owner

A default date format can not be applied as follows:

import xlsxwriter
from datetime import datetime

workbook = xlsxwriter.Workbook('datetimes.xlsx', {'default_date_format':
                                                  'dd/mm/yy'})
worksheet = workbook.add_worksheet()
date_time = datetime.now()
worksheet.write_datetime(0, 0, date_time)  # Formatted as 'dd/mm/yy'

workbook.close()
Owner

jmcnamara commented Jul 26, 2013

A default date format can not be applied as follows:

import xlsxwriter
from datetime import datetime

workbook = xlsxwriter.Workbook('datetimes.xlsx', {'default_date_format':
                                                  'dd/mm/yy'})
worksheet = workbook.add_worksheet()
date_time = datetime.now()
worksheet.write_datetime(0, 0, date_time)  # Formatted as 'dd/mm/yy'

workbook.close()

@jmcnamara jmcnamara closed this Jul 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment