2

I have downloaded the Joda jar and have imported 'org.joda.time.LocalDate' in my class. I have to get the current date and store it in the datastore.

LocalDate localdate = new LocalDate();

When i am trying to store the value in the datastore, I am getting error as

"date: org.joda.time.LocalDate is not a supported property type."

How do i resolve this? Thanks in advance...

User_007
  • 165
  • 2
  • 15
  • `new LocalDate()` uses a default time zone. Since you are on App Engine, why not use `new DateTime()` instead? – Andrei Volgin Nov 21 '14 at 18:27
  • The error "date: org.joda.time.LocalDate is not a supported property type." indicates, that the type (Java class) of the property with name "date" is not allowed as a property of an Entity. This is a technical problem (or better a restriction by the app engine) and has nothing to do with default time zones. Using the Joda DateTime class will cause exactly the same problem! – gclaussn Dec 02 '14 at 13:43

1 Answers1

2

Please take a look at: Google App Engine (Java) -> Storing Data -> Datastore -> Entities, Properties, and Keys

In section "Properties and value types" you will find the supported/allowed property types. For date and time properties only java.util.Date is supported. This means you need to convert the org.joda.time.LocalDate to a java.util.Date instance before setting the property of an entity. Please refer on following post for conversation: How to convert Joda LocalDate to java.util.Date?

Community
  • 1
  • 1
gclaussn
  • 1,736
  • 16
  • 19