title: error in getting previous year from current year
body: <p>I am trying to get previous year from current year. </p>
  
  <pre><code> private void lastyear() {
              pd = new ProgressDialog(getActivity());
              pd.setTitle("Please Wait...");
              pd.setCancelable(false);
              pd.show();
  
              Date lastyear = new Date();
              Calendar calendar = Calendar.getInstance();
              calendar.setTimeInMillis(lastyear.getTime());
              calendar.add(Calendar.YEAR, -1);
  
              lastyear = new Date(calendar.get(Calendar.YEAR));
              Log.e("lastyear", String.valueOf(lastyear));
  
  
              db.collection("Orderers").document(user_id).collection("OpenOrders")
                      .whereEqualTo("OrderPlacedDateTime", lastyear)
                      .orderBy("OrderPlacedDateTime", Query.Direction.DESCENDING)
                      .get()
                      .addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
                              if (task.isSuccessful()) {
  
                                  ls_data.clear();
  
                                  for (DocumentSnapshot document : task.getResult()) {
  
                                      if (document.exists()) {
  
                                          final String DeliveryMethod = (String) document.get("DeliveryMethods");
                                          final String ProductName = (String) document.get("ProductName");
                                          final Object Price1 = document.get("ProductPrice");
                                          final String Price = String.valueOf(Price1);
                                          final Object FinalPrice1 = document.get("FinalPrice");
                                          final String FinalPrice = String.valueOf(FinalPrice1);
                                          final String date = String.valueOf(document.get("OrderPlacedDateTime"));
                                          final String Orderid = (String) document.get("OrderId");
                                          final String image3 = (String) document.get("ProductImage");
  
                                          Model m = new Model();
  
                                          m.setName(ProductName);
                                          m.setPrice(Price);
                                          m.setDate(String.valueOf(date));
                                          m.setOrderid(Orderid);
                                          m.setimage3(image3);
                                          m.setFinalPrice(FinalPrice);
                                          m.setDeliveryMethods(DeliveryMethod);
  
                                          ls_data.add(m);
  
                                      }
  
                                  }
  
                                  try {
                                      adapter = new CustomAdapterOrders(getActivity(), ls_data, getActivity());
                                  } catch (Exception ex) {
                                      Log.e("Error", "Dashboard : " + ex);
                                  }
  
                                  listView.setAdapter(adapter);
                                  adapter.notifyDataSetChanged();
                                  swipeLayout.setRefreshing(false);
                                  listView.setVisibility(View.VISIBLE);
                                  pd.dismiss();
  
                              }else{
                                  pd.dismiss();
                                  Toast.makeText(getActivity(), "No open orders yet", Toast.LENGTH_SHORT).show();
                                  //listView.setAdapter(adapter);
                                  listView.setVisibility(View.GONE);
                                  //adapter.notifyDataSetChanged();
                                  swipeLayout.setRefreshing(false);
                              }
  
                          }
                      });
          }
  </code></pre>
  
  <p>It should return me 2017 as result.But its returning wrong output as follows</p>
  
  <p>a E/Filter  by:: Last year
  05-21 10:43:44.676 11437-11437/com.bodaty.samyata.samyata E/lastyear: Thu Jan 01 00:00:02 GMT+00:00 1970</p>
  
  <p>All the orders present in 2017 should be displayed
  Thanks inadvance</p>