Ejemplo n.º 1
0
	def __new__(cls, x, **kwargs):
		day   = (x>> 0)&0xff
		month = (x>> 8)&0xff
		year  = (x>>16)&0xffff
		try:
		    dday   = bcd2int(day)
		    dmonth = bcd2int(month)
		    dyear  = bcd2int(year)
		    if not year: return None
		    return datetime.date.__new__(cls, dyear, dmonth, dday)
		except:
		    return "%04x-%02x-%02x" % (year, month, day)
Ejemplo n.º 2
0
	def __new__(cls, x, **kwargs):
		day   = bcd2int((x>> 0)&0xff)
		month = bcd2int((x>> 8)&0xff)
		year  = bcd2int((x>>16)&0xffff)
		if not year: return None
		return datetime.date.__new__(cls, year, month, day)