code: public static Date parseDateTime(String s, TimeZone tz)
      {
          DateFormat df;
  
          if (s == null)
          {
              return null;
          }
  
          df = new SimpleDateFormat(DATE_TIME_PATTERN);
          if (tz != null)
          {
              df.setTimeZone(tz);
          }
          try
          {
              return df.parse(s);
          }
          catch (ParseException e)
          {
              return null;
          }
      }
docs: Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using
  the given time zone.
  
  @param s date string in the form of "yy-MM-dd HH:mm:ss"
  @param tz the timezone to use or <code>null</code> for the default time
  zone.
  @return the corresponding Java date object or <code>null</code> if it is
  not parsable.