title: Typescript converting the timestamp into mm-dd format
body: <p>Angular has a pipe for converting a timestamp into a date. I have searched a lot on the web and there is no good solution for this in typescript.</p>
  
  <p>I tried Javascript conversion but didn't get the desired result. I need to get the data in this format <strong>EEEE, MMMM d</strong> which is <strong>Tuesday, January 25</strong> I know we can achieve this using pipes in our template but do not how to get this in typescript. </p>
  
  <p>I tried </p>
  
  <pre><code>formatDate(date) {
     let d = new Date(date * 1000)
     return d.getMonth() + 1 + "," + d.getDate
  }
  </code></pre>
  
  <p>and used in my code like this </p>
  
  <pre><code>for(let i=0; i &lt; this.lessons.length; i++){
        for(let j=1; j&lt; this.lessons.length; j++){
          if(this.formatDate(this.lessons[i].start_time) === this.formatDate(this.lessons[j].start_time)){
            this.data.push({title: this.formatDate(this.lessons[i].start_time), lessons: []})
          }
        }
      }
      console.log(this.data)
    })
  </code></pre>
  
  <p>but no luck all it is coming in my console is like this : </p>
  
  <pre><code>{title: "NaN,function getDate() { [native code] }", lessons: Array(0)}
  </code></pre>
  
  <p>Could anyone help with this. Thanks in advance!</p>