Skip to content

Instantly share code, notes, and snippets.

@markhibberd
Created June 3, 2014 02:51
Show Gist options
  • Save markhibberd/9a9101c58bba49312057 to your computer and use it in GitHub Desktop.
Save markhibberd/9a9101c58bba49312057 to your computer and use it in GitHub Desktop.
import com.ambiata.ivory.core._
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormat
import org.joda.time.{DateTime => JodaDateTime}
val d = DateTime(2005,11,6,0)
val localZ = DateTimeZone.forID("America/Swift_Current")
val ivoryZ = DateTimeZone.forID("America/Thunder_Bay")
val s = d.localIso8601
val x = Dates.datetime(s, localZ, ivoryZ).get
val zz = x.joda(ivoryZ).withZone(localZ)
val r = DateTime.unsafe(zz.getYear.toShort, zz.getMonthOfYear.toByte, zz.getDayOfMonth.toByte, zz.getSecondOfDay.toInt)
println(r == d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment