i am reading date from excel which is in this format 12/5/2012 day/month/year using this code to read . using PHP EXCEL
PHPExcel_Style_NumberFormat::t
If you're using python I resolved this issue by add xldate class from xlrd lib, here I show you the code (This is in Odoo 10 module):
from xlrd import open_workbook, xldate
wb = open_workbook(file_contents=excel_file)
data_sheets = []
# Parse all data from Excel file
for s in wb.sheets():
data_rows = []
headers = []
for row_key, row in enumerate(range(s.nrows)):
if row_key != 0:
data_row = {}
for index, col in enumerate(range(s.ncols)):
value = s.cell(row, col).value
key = headers[int(index)]
if key == 'Date' and (isinstance(value, float) or isinstance(value, int)):
value = xldate.xldate_as_datetime(value, wb.datemode)
data_row[key] = value
else:
data_row[key] = value
data_rows.append(data_row)
else:
for index, col in enumerate(range(s.ncols)):
value = (s.cell(row, col).value)
headers.append(value)
data_sheets.append(data_rows)
value = xldate.xldate_as_datetime(value, wb.datemode) will return datetime object with correct values