Guest User

Untitled

a guest
Aug 9th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. Simplest way to get local milliseconds in a time zone with Joda-Time
  2. long localMillis = dateTime.withZone(timeZone).toLocalDateTime()
  3. .toDateTime(DateTimeZone.UTC).getMillis();
  4.  
  5. private static final JAN_1_1970 = new LocalDateTime(1970, 1, 1, 0, 0);
  6.  
  7. ...
  8.  
  9. new Duration(JAN_1_1970.toDateTime(someTimeZone), endPointInstantOrDateTime).getMillis();
Advertisement
Add Comment
Please, Sign In to add comment