User_007
User_007

Reputation: 165

How to use Joda LocalDate and DateTime in Google App Engine?

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...

Upvotes: 2

Views: 1742

Answers (1)

gclaussn
gclaussn

Reputation: 1796

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?

Upvotes: 2

Related Questions