public static void writeDateTime32(OutputStream output, LocalDateTime value, TimeZone tz) throws IOException {
        long time = tz == null || tz.equals(ClickHouseValues.UTC_TIMEZONE) ? value.toEpochSecond(ZoneOffset.UTC)
                : value.atZone(tz.toZoneId()).toEpochSecond();

        writeUnsignedInt32(output, ClickHouseChecker.between(time, ClickHouseValues.TYPE_DATE_TIME, 0L, DATETIME_MAX));
    }
Write a {@link java.time.LocalDateTime} to given output stream.

@param output non-null output stream
@param value  local datetime
@param tz     time zone, null is treated as UTC
@throws IOException when failed to write value to output stream or reached
                    end of the stream
clickhouse-data/src/main/java/com/clickhouse/data/format/BinaryStreamUtils.java