title: How to specify a timezone for a joda DateTime object?
body: <p>I have a function that converts a string into a joda time object and formats it.</p>
  
  <pre><code>public static String getFormattedDatetime(String someDate) {
      DateTime newDate = DateTime.parse(someDate, DateTimeFormat.forPattern("yy-MM-dd HH:mm:ss.SSS")).minusHours(7);
      String formattedDate = newDate.toString("dd-MMM-yy hh:mm a");
  
      return formattedDate;
  }
  </code></pre>
  
  <p>The function takes the string and returns a formatted DateTime just fine, but I'm having troubles assigning a TimeZone to it. The string that I'm passing in represents a UTC time from the database that I need to convert to PST/PDT. I can't figure out a way to 1) assign the new DateTime object a timezone and 2) convert that object's timezone to PST/PDT. Right now I am handling this with .minusHours. Certainly not ideal.</p>