title: Joda Time: Convert UTC to local
body: <p>I want to convert a Joda Time UTC DateTime object to local time.</p>
  
  <p>Here's a laborious way to do it which seems to work. But there must be a better way.</p>
  
  <p>Here's the code (in Scala) without surrounding declarations:</p>
  
  <pre><code>    val dtUTC = new DateTime("2010-10-28T04:00")
      println("dtUTC = " + dtUTC)
      val dtLocal = timestampLocal(dtUTC)
      println("local = " + dtLocal)
  
   def timestampLocal(dtUTC: DateTime): String = {
      // This is a laborious way to convert from UTC to local. There must be a better way.
      val instantUTC = dtUTC.getMillis
      val localDateTimeZone = DateTimeZone.getDefault
      val instantLocal = localDateTimeZone.convertUTCToLocal(instantUTC)
      val dtLocal = new DateTime(instantLocal)
      dtLocal.toString
    }
  </code></pre>
  
  <p>Here's the output:</p>
  
  <p>dtUTC = 2010-10-28T04:00:00.000+11:00
  local = 2010-10-28T15:00:00.000+11:00</p>