def decimal_to_dt(dec):
 if (dec is None):
  return None
 integer = int(dec)
 micro = ((dec - decimal.Decimal(integer)) * decimal.Decimal(units.M))
 daittyme = datetime.datetime.utcfromtimestamp(integer)
 return daittyme.replace(microsecond=int(round(micro)))

def decimal_to_dt ( dec ) : if ( dec is None ) : return None integer = int ( dec ) micro = ( ( dec - decimal . Decimal ( integer ) ) * decimal . Decimal ( units . M ) ) daittyme = datetime . datetime . utcfromtimestamp ( integer ) return daittyme . replace ( microsecond = int ( round ( micro ) ) )
return a datetime from decimal unixtime format .