1

I've got a table called Person with three columns:

  • id

  • name

  • registeredDate

Where registeredDate is LocalDateTime.

I am trying to write a query using Query By GQl as following:

Select * from person

I'm getting the following data output

Id  name  registeredDate

1  Xyz   2009-10-09(09:30:00.000) IST

When I'm trying with following query:

Select Id, registeredDate from person

I'm getting following output:

Id  registeredDate

1. 1255060800000000

I don't know why the datetime field is not displaying properly. Why it is getting converted automatically. How to make it display as LocalDateTime format.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37

1 Answers1

1

Date and time value, returned as part of a projection query, is being converted by the Datastore mode to microsecond integer values.

This is one of the limitations on projections described in the documentation as follows:

In the results of a projection query, Datastore mode converts timestamp values to microsecond integer values.

You'll need to use other query types to return the registeredDate not in microseconds.

Farid Shumbar
  • 1,360
  • 3
  • 10
  • I can go with other way writing a new query. But I need a way to convert it into LocalDateTime in java when it is fetching. Can anybody gives an example? – Suresh D Vijay Jun 06 '21 at 17:25
  • @SureshDVijay did you find a way to resolve this? I'm facing the same issue that my entity field is LocalDateTime and It returns Long with projection query – Joshgun Apr 07 '22 at 06:01