title: How do I display local time with Groovy's .format() method?
body: <p>I have a set of dates that were saved to the database with the following code (which I can't change):</p>
  
  <pre><code>Date date = new Date()
  save(date)
  </code></pre>
  
  <p>Is there no clean way in groovy to reformat and display the date in the user's local time zone? Such as ...</p>
  
  <pre><code>dateCreated.format('h:mm a MMMM dd, yyyy', Locale.US)
  </code></pre>
  
  <p>Is nothing like that built into Groovy? Is the only solution?</p>
  
  <pre><code>import java.text.SimpleDateFormat
  
  String date = dateCreated.format('h:mm a MMMM dd, yyyy')
  def fmt = new SimpleDateFormat('h:mm a MMMM dd, yyyy', Locale.US);
  Date local_time = fmt.parse(date);
  String formatted_local = local_time.format('h:mm a MMMM dd, yyyy')
  formatted_local
  </code></pre>
  
  <p>Groovy Date Documentation: <a href="http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Date.html#format(java.lang.String)" rel="nofollow noreferrer">http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Date.html#format(java.lang.String)</a></p>
  
  <p>Reference: <a href="https://stackoverflow.com/questions/2219139/how-to-parse-month-full-form-string-using-dateformat-in-java">How to parse month full form string using DateFormat in Java?</a></p>