Hi,
I have a java.util.Date data type in my object.
Date now = Calendar.getInstance(TimeZone.getTimeZone(America/Los_Angeles),
Locale.US).getTime();
When I persist the object and look at the entity, I see the type stored as
gd:when as the kind of element.
I see the value as 2012-01-25
You must store the TZ as a separate field.
Alternatively, if you don't need the date to be indexed, you can
convert it back and forth to a String that preserves TZ info (eg, the
ISO-8601 format).
Jeff
On Wed, Jan 25, 2012 at 12:53 PM, Kesava Neeli nke...@gmail.com wrote:
Hi,
I have a
Thanks. That's what I was doing for some date fields now. Store the date in
a well formatted string and then do conversions. But it becomes tough when
you want to build a query get me all records in last day and the
datastore for that object contains thousands of records. With the strings,
Taking a step back, I should say that if you're using java.util.Date
with timezone info, you're doing it wrong. java.util.Date is a
trainwreck, and any methods that affect an internal notion of a TZ
have been deprecated. If you care about timezones, using Date is a
mistake - it's best to think
Thanks Jeff. I used JodaTime before but I was stuck with java.util.Date
since appengine allows only standard java data types. I don't think Joda
Time object will work on appeninge. Will give a try. Have you stored
JodaTime objects in datastore?
--
You received this message because you are
I store DateTime, LocalDate, LocalDateTime, and DateTimeZone quite a
lot, but I use Objectify (disclosure: I'm the lead author) which
handles the translation for you (if you enable it). ReadableInstant
objects (eg DateTime) are stored natively as java.util.Date and Local
objects (LocalDate,