java.util.HashMap cannot be cast to java.util.Date : <p>I am trying to get a timestamp from cloud firestore and store it in a date variable but I am getting this exception :</p>

<pre><code>java.util.HashMap cannot be cast to java.util.Date
</code></pre>

<p>this is the code for getting the value from the cloud firestore : </p>

<pre><code>Date timeStamp = (Date) dataSnapshot.get("date");
</code></pre>

<p>and this is the code for storing the date in the database :</p>

<pre><code>map.put("date", ServerValue.TIMESTAMP);
</code></pre>

<p>I can't figure out how to solve this error</p>
