title: How to manage timezones between DB and Web Application (Existing Database in Local time)
body: <p>I have googled this question before posting it to here. I didn't find the solution specific to my question, so here I go. Please forgive me, if not doing it right. </p>
  
  <p>I am using Java, JSP, Tomcat and Oracle 9i/10g.</p>
  
  <p>I have existing database with data stored into it for local time. For instance, If table is "Appointment" then all Scheduled Date, Created Date and Changed Date  - data is stored into DB with "Date dt = new java.util.Date();" and the SQL statement "INSERT into Appointment (Scheduled Date, Created Date, Changed Date) values (?,?,?)"</p>
  
  <pre><code>Date dt = new java.util.Date();
  ...
  String query ="INSERT into Appointment (Scheduled Date, Created Date, Changed Date) values (?,?,?)";
  ...
  pstmt.setDate(1, users_browser_selected_date);
  pstmt.setDate(2, dt);
  pstmt.setDate(3, dt);
  ......
  </code></pre>
  
  <p>THE CODE IS GIVEN FOR DESCRIPTION ONLY. PLEASE DISREGARD ANY CODE/LOGICAL ERRORS...</p>
  
  <p>The data is already stored at this point using above code. Meaning its storing local time. And I am not allowed to change the data at this point. (I know that the best practice is to use UTC format to store the data. But its late at this point to make that change.)</p>
  
  <p>Now the user can be using the web application in any time zone, and if user make a search operation on the data based on time from his/her browser then the data needs to be accurate and consistent.</p>
  
  <p>Is there a way that I can accomplish this, without touching my DB? What changes can be made to show date on search form at the browser? What changes can be made when executing search query in Java Code to the DB?</p>
  
  <p>It would be helpful, if you can provide some steps.</p>
  
  <p>Thank you so much.</p>