def retrieveVfpDateTime(bytes, fielddef={}, memo=None): """returns the date/time stored in bytes; dates <= 01/01/1981 00:00:00 may not be accurate; BC dates are nulled.""" # two four-byte integers store the date and time. # millesecords are discarded from time time = retrieveInteger(bytes[4:]) microseconds = (time % 1000) * 1000 time = time // 1000 # int(round(time, -3)) // 1000 discard milliseconds hours = time // 3600 mins = time % 3600 // 60 secs = time % 3600 % 60 time = Time(hours, mins, secs, microseconds) possible = retrieveInteger(bytes[:4]) possible -= VFPTIME possible = max(0, possible) date = Date.fromordinal(possible) return DateTime.combine(date, time)
def retrieveDate(bytes, fielddef={}, memo=None): "Returns the ascii coded date as a Date object" return Date.fromymd(bytes.tostring())
def unpackDate(bytestr): "Returns a Date() of the packed three-byte date passed in" year, month, day = struct.unpack('<BBB', bytestr) year += 1900 return Date(year, month, day)