title: Why does Calendar.getDisplayName always return the same day of week when given milliseconds?
body: <p>I'm trying to create an extension method to determine the name of the day within a week, given a specific Long value, so that it returns Monday, Tuesday, etc.</p>
  <pre><code>fun Long.convertFromLongToDayOfWeek(): String {
  
      val calendar = Calendar.getInstance()
  
      calendar.timeInMillis = this
  
      return calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault()) ?: &quot;&quot;
  }
  </code></pre>
  <p>however, regardless of the value I pass to the calendar instance, it always returns &quot;Monday&quot;.</p>
  <p>I've written a few unit tests with Long values (which I receive from an API) and they all return Monday. Values to test with include the following:</p>
  <ul>
  <li>1601542800</li>
  <li>1601715600</li>
  <li>1601629200</li>
  </ul>
  <p>This code is complete and inclusive up to here, the following unit tests are just there to simplify debugging:</p>
  <hr />
  <pre><code>   @Test
      fun testExample1() {
  
      val value: Long = 1601542800
  
      val result = value.convertFromLongToDayOfWeek()
  
      Assert.assertEquals(&quot;Monday&quot;, result)
  
      }
  
      @Test
      fun testExample2() {
  
      val value: Long = 1601715600
  
      val result = value.convertFromLongToDayOfWeek()
  
      Assert.assertEquals(&quot;Monday&quot;, result)
  
     }
  </code></pre>
  <p>both of these tests are passing, but neither of these Long values represent Monday, what am I doing wrong ?</p>