title: Convert UTC time to local time in Javascript, giving future date
body: <p>I am getting <strong>created_at timestamp from backend in UTC format</strong>, which i need to render in browser. I am <strong>using date pipe in Angular-7</strong>. After reading few blogs and stackoverflow, i wrote this function below to get normal date format, which i can pass through date pipe in angular to format.</p>
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC</a></p>
  <ul>
  <li><strong>Issue</strong>: The output is in future date.</li>
  <li><strong>Input</strong>: &quot;22-12-2020 03:44:09 UTC&quot;</li>
  <li><strong>Output</strong>: &quot;Fri Jan 22 2021 09:14:09 GMT+0530 (India Standard Time)&quot;</li>
  </ul>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>getDateFromUTC(dateString: string) {
      const date = dateString
        .split(" ")[0]
        .split("-")
        .map((number) =&gt; parseInt(number));
      const hours = dateString
        .split(" ")[1]
        .split(":")
        .map((num) =&gt; parseInt(num));
  
      const convertedDate = new Date(
  Date.UTC(date[2], date[1], date[0], hours[0], hours[1],hours[2])
      );
      return convertedDate;
  }
  getDateFromUTC("22-12-2020 03:44:09 UTC")</code></pre>
  </div>
  </div>
  </p>
  <p>What am i doing wrong?</p>