Skip to content

Instantly share code, notes, and snippets.

@vpipkt
Last active June 1, 2017 19:42
Show Gist options
  • Save vpipkt/7dc0074aa92b749143921b9ad611c31f to your computer and use it in GitHub Desktop.
Save vpipkt/7dc0074aa92b749143921b9ad611c31f to your computer and use it in GitHub Desktop.
import java.time._
import org.joda.time._
val j8 = ZonedDateTime.now(ZoneId.of("Z"))
//j8: java.time.ZonedDateTime = 2017-06-01T19:40:54.933Z
val z = DateTimeZone.forOffsetMillis(j8.getOffset.getTotalSeconds * 1000)
//z: org.joda.time.DateTimeZone = UTC
val jodated = new DateTime(j8.toInstant().toEpochMilli(), z)
// jodated: org.joda.time.DateTime = 2017-06-01T19:40:54.933Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment