title: How to pass a DateTime value as parameter in Java Driver for Neo4J?
body: <p>I am using the Neo4J Java driver</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.neo4j.driver&lt;/groupId&gt;
      &lt;artifactId&gt;neo4j-java-driver&lt;/artifactId&gt;
      &lt;version&gt;4.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>And I am trying to use a DateTime value as value in a parameter map roughly like this:</p>
  <pre><code>// we have a timezone, unixTimestamp as epoch seconds and a simple key: &quot;d&quot;
  final Instant instant = Instant.ofEpochSecond(unixTimestamp);
  final ZoneId zoneId = ZoneId.of(timezone);
  final ZonedDateTime zonedValueDate = ZonedDateTime.ofInstant(instant, zoneId);
  // creating a DateTimeValue from zonedValueDate does not work either
  return Map.of(key, zonedValueDate);
  </code></pre>
  <p>This map is used in an instance of <code>TransactionWork</code> like</p>
  <pre><code>public Map&lt;String,Object&gt; execute(Transaction tx) {
      Result queryResult = tx.run(query, parameter);
      // consuming results ...
      // returning them as Map
  }
  </code></pre>
  <p>But I am getting an exception:</p>
  <pre><code>org.neo4j.driver.exceptions.ClientException: Property values can only be of primitive types or arrays thereof
  </code></pre>
  <p>A <code>DateTime</code> or <code>ZonedDateTime</code> <a href="https://neo4j.com/docs/driver-manual/current/cypher-workflow/#driver-type-mapping" rel="nofollow noreferrer">should be allowed as parameter</a> (<a href="https://community.neo4j.com/t/unable-to-convert-to-neo4j-value-java-bolt-driver/14325/2" rel="nofollow noreferrer">here is another hint</a>), but how can it be used correctly?</p>
  <p>Or do I <strong>HAVE</strong> to create a DateTime value like <a href="https://neo4j.com/docs/cypher-manual/current/functions/temporal/#functions-datetime-temporal" rel="nofollow noreferrer">this</a>:</p>
  <pre><code>datetime({year:1984, month:10, day:11, hour:12, timezone: 'Europe/Stockholm'})
  </code></pre>