def update_vfp_datetime(moment, *ignore):
"""
Sets the date/time stored in moment
moment must have fields:
year, month, day, hour, minute, second, microsecond
"""
data = [0] * 8
if moment:
hour = moment.hour
minute = moment.minute
second = moment.second
millisecond = moment.microsecond // 1000 # convert from millionths to thousandths
time = ((hour * 3600) + (minute * 60) + second) * 1000 + millisecond
data[4:] = update_integer(time)
data[:4] = update_integer(moment.toordinal() + VFPTIME)
return bytes(data)
评论列表
文章目录