def prepare(cls, value):
        """Pack datetime value into proper binary format"""
        pfield = struct.pack('b', cls.type_code)
        if isinstance(value, string_types):
            value = datetime.datetime.strptime(value, "%Y-%m-%d")
        year = value.year | 0x8000  # for some unknown reasons year has to be bit-or'ed with 0x8000
        month = value.month - 1     # for some unknown reasons HANA counts months starting from zero
        pfield += cls._struct.pack(year, month, value.day)
        return pfield
Pack datetime value into proper binary format