def get_date(dfield, fileo): """Return date value from file object.""" filename = fileo.filename _date = filename.split('-')[1].split('.')[0] y, m, d = _date[:4], _date[4:6], _date[6:8] y, m, d = int(y), int(m), int(d) return DateValue._instance(dfield, y, m, d)
def get_date(dfield, fileo): """Return date value from file object.""" filename = fileo.filename elms = filename.split('_') part = elms[1].split('.')[0] _date = part.split('-') y, m, d = int(_date[0]), int(_date[1]), int(_date[2].split()[0]) return DateValue._instance(dfield, y, m, d)
def get_date(dfield, fileo): """Return date value from file object.""" filename = fileo.filename elms = filename.split('-') if len(elms) < 3: date = elms[1].split('.')[0] else: date = elms[1] y, m, d = int(date[:4]), int(date[4:6]), int(date[6:8]) return DateValue._instance(dfield, y, m, d)