I want to convert Google DateTime
into org.joda.time.DateTime
.
This is the code of Google's implementation.
How I can implement this?
Returns the date/time value expressed as the number of milliseconds since the Unix epoch. If the time zone is specified, this value is normalized to UTC, so to format this date/time value, the time zone shift has to be applied.
public DateTime(long instant)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone.
// getValue() return millis since epoch
long millis = googleDate.getValue();
// Which is accepted by Joda DateTime's constructor
DateTime jodaDate = new DateTime(millis);
Probably it is too late, but I have just solve a quite similar problem as follows
//Let's suppose date is our google DateTime
org.joda.time.DateTime jodaDate = date.getDateTime(date.getValue);
This creates a new joda DateTime from the google DateTimes' long value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.