title: passing timezone from client (GWT) to server (Joda Time)
body: <p>I'm using GWT on the client (browser) and Joda Time on the server.  I'd like to perform some DB lookups bounded by the day (i.e. 00:00:00 until 23:59:59) that a request comes in, with the time boundaries based on the user's (i.e. browser) timezone.</p>
  
  <p>So I have the GWT code do a <code>new java.util.Date()</code> to get the time of the request, and send that to the server.  Then I use Joda Time like so:</p>
  
  <pre><code>new DateTime(clientDate).toDateMidnight().toDateTime()
  </code></pre>
  
  <p>The trouble of course is that <code>toDateMidnight()</code>, in the absence of a specified TimeZone, will use the system's (i.e. the server's) TimeZone.  I've been trying to find a simple way to pass the TimeZone from the browser to the server without much luck.  In GWT I can get the GMT offset with:</p>
  
  <pre><code>DateTimeFormat.getFormat("Z").fmt(new Date())
  </code></pre>
  
  <p>which results in something like "-0400".  But Joda Time's <code>DateTimeZone.forID()</code> wants strings formatted like "America/New_York", or an integer argument of hours and minutes.  Of course I can parse "-0400" into -4 hours and 0 minutes, but I'm wondering if there is not a more straightforward way of doing this.</p>