title: Java date displays previous day , month and totally different year
body: <p>I am trying to display Date based on timezone. </p>
  
  <p>If I change my system time zone to US pacific time zone, today's date is displayed correctly. If I want to display 2000-01-01 output shows as 12/31/1969.</p>
  
  <p>Can you please let me know if I have to make any change in system settings or java settings?. 
  Below is the example code:</p>
  
  <pre><code>package timezoneexample;  
  import java.text.DateFormat;
  import java.util.Date;
  import java.util.TimeZone;
  
  
  public class TimezoneExample {
  
  public static void main(String args[]) {
      DateFormat dateFormat = null;
  
      String datePattern = null;
      char dateSeperator = '/';
      try {
          datePattern = "MM/dd/yyyy";
          if (datePattern.length() &lt;= 0)
              throw new java.util.MissingResourceException(
                      "Didn't find date format", "", "");
          boolean hasSeperatorAlready = false;
          for (int i = 0; i &lt; datePattern.length(); i++)
              if (!Character.isLetter(datePattern.charAt(i)))
                  if (hasSeperatorAlready)
                      throw new java.util.MissingResourceException(
                              "Unvalid date format", "", "");
                  else
                      dateSeperator = datePattern.charAt(i);
      } catch (java.util.MissingResourceException mre) {
          System.out.println(mre);
      }
  
      dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
      if (datePattern.length() &gt; 0
              &amp;&amp; dateFormat instanceof java.text.SimpleDateFormat) {
          java.text.SimpleDateFormat sdf = (java.text.SimpleDateFormat) dateFormat;
          sdf.applyPattern(datePattern);
      }
  
      dateFormat.setTimeZone(java.util.TimeZone.getDefault());
  
      // enter DOB
      Date dob = new Date(2000 - 01 - 01);
      Date today = new Date();
      String timeZone = System.getProperties().getProperty("user.timezone");
  
      TimeZone tZone = TimeZone.getTimeZone(timeZone);
  
      System.out.println("Timezone : " + tZone);
  
      dateFormat.setTimeZone(tZone);
  
      System.out.println("Date Of Birth : " + dateFormat.format(dob));
      System.out.println("Date in Displayed as per Timezone : "
              + dateFormat.format(today));
  
  }
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Timezone : sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
  </code></pre>
  
  <p>Date Of Birth : 12/31/1969</p>
  
  <p>Date in Displayed as per Timezone : 01/07/2015</p>