# Error loading Data of type Date in Spring Boot

**URL:** <https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209>\
**Category:** Neo4j Graph Platform\
**Tags:** apoc, cypher\
**Created:** [July 9, 2023, 10:26pm UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209 "2023-07-09T22:26:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dairon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dairon/32/28830_2.png) [@dairon](https://community.neo4j.com/u/dairon)\
**Post date:** [July 9, 2023, 10:26pm UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209/1 "2023-07-09T22:26:37Z")

</div>

Hi, greetings to all graph lovers like me.

I am facing a problem for which I turn to the community for help.  
I have created a Fake Graph in python using the driver I normally install  
`pip install neo4j`

I have a node with a property of type datetime and when I try to load the data from the backend of the project in java with Spring Boot it gives me this error:

`org.neo4j.driver.exceptions.value.Uncoercible: Cannot coerce STRING to LocalDateTime`

In python to try to correct this error I ran this code:

```auto
conn.query("""
             MATCH (r:Review)
             set r.dateTimeMoment = apoc.date.format(datetime(r.dateTimeMoment).epochMillis, "ms", "yyyy-MM-dd'T'HH:mm:ss")
             """)

```

but the problem of reading date type data from spring data persists.

In the node model in java my property is declared like this:  
`private LocalDateTime dateTimeMoment;`

Cordially greetings

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [July 10, 2023, 12:15am UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209/2 "2023-07-10T00:15:23Z")

</div>

That apoc method converts a date string in one format to another date string in a different format, so it will not do what you want.

If you are trying to extract the value into a LocalDateTime value in java, then you should save the value as a timestamp in Neo4j. Assuming the issue is due to the date being stored as a string representation, convert it to a date time by passing the string value to datetime.

```auto
MATCH (r:Review) set r.dateTimeMoment = datetime(r.dateTimeMoment)

```

---

<div class="post-metadata">

**Author:** ![dairon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dairon/32/28830_2.png) [@dairon](https://community.neo4j.com/u/dairon)\
**Post date:** [July 10, 2023, 1:40am UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209/3 "2023-07-10T01:40:53Z")

</div>

Thanks, i used your code and the error change to this new message:  
`org.neo4j.driver.exceptions.value.Uncoercible: Cannot coerce DATE_TIME to LocalDateTime`

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [July 10, 2023, 3:07am UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209/4 "2023-07-10T03:07:15Z")

</div>

Sorry, try 'localdatetime' if you want your java type to be an instance of LocalDateTime. Use 'datetime' if you type your java object to ZonedDateTime instead.

---

<div class="post-metadata">

**Author:** ![dairon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dairon/32/28830_2.png) [@dairon](https://community.neo4j.com/u/dairon)\
**Post date:** [July 10, 2023, 12:26pm UTC](https://community.neo4j.com/t/error-loading-data-of-type-date-in-spring-boot/63209/5 "2023-07-10T12:26:41Z")

</div>

Hi, @glilienfield

Thanks, this fixed a big problem to me.
