title: Saving and retrieving date in Firebase
body: <p>I have a model with the following structure  </p>
  
  <pre><code>public class OfferModel {
      private String mImageUrl;
      private String mOfferCode;
      private String mOfferTitle;
      private String mOfferDescription;
      private boolean mIsRunning;
      private String mCreatorUid;
      private Date mStartDate;
  }
  </code></pre>
  
  <p>Everything else works fine on saving. It saves in Firebase Realtime database as</p>
  
  <pre><code>startDate
      date: 22
      day: 3
      hours: 23
      minutes: 20
      month: 5
      seconds: 50
      time: 1466617850476
      timezoneOffset: -330
      year: 116
  </code></pre>
  
  <p>But when I try to retrieve it, the date gives the following error - </p>
  
  <pre><code>java.lang.ClassCastException: java.util.HashMap cannot be cast to java.util.Date
  at com.localvine.models.OfferModel.&lt;init&gt;(OfferModel.java:37)
  at com.localvine.managers.OfferManager$1.onDataChange(OfferManager.java:62)
  at com.google.android.gms.internal.zzafp.zza(Unknown Source)
  at com.google.android.gms.internal.zzagp.zzSu(Unknown Source)
  at com.google.android.gms.internal.zzags$1.run(Unknown Source)
  at android.os.Handler.handleCallback(Handler.java:615)
  </code></pre>
  
  <p>I understand that Firebase doesn't support Java Date object, but since it's saving them in a map, how can I get back the date from that map? Is there any proper way of saving and retrieving dates in Firebase Android?</p>