import xlrd #导入模块
from xlrd import xldate_as_tuple #调用xlrd的xldate_as_tuple模块或者xldate_as_datetime模块,用于Excel中的日期转换。
code:
from xlrd import xldate_as_tuple
from xlrd import xldate_as_datetime
import date
xlrd.xldate_as_tuple (table.cell_vlue(2,2),0)
xldate_as_tuple (date,mode)函数参数
参数一:date,excel的小数日期
参数二:mode,两种取值,0或1,0代表日期以1900-01-01为基准,1代表日期以1904-01-01为基准。该函数返回的是一个元组,他的值类似:(year, month, day, hour, minute, nearest_second)
通常WIndows使用前者0,Mac使用后者1。