title: How to manage datetime in angular
body: <p>I'm working with Angular(v5).
  I have some problem with Datetime.</p>
  
  <p>I need the current time and I have to save it in a variable. After that I have to subtract an interval of hours (8 hours or an hour) and save the result in a variable and then do it with<code>console.log</code>.</p>
  
  <p>I need the format to be: <code>YYYY-MM-DD HH:mm:ss</code></p>
  
  <p>I tried to integrate <code>moment.js</code> without fail but I always get errors in the console, how can I solve?</p>
  
  <p>I upload my <a href="https://stackblitz.com/edit/angular4-momentjs-datetime" rel="noreferrer">code here</a></p>
  
  <p>is there a way to manage datetime in angular simply?</p>
  
  <p>thanks</p>