title: Convert Date to Minute and Minute to Date in Angular/Express
body: <p>This is my uebersetzer.service.js:</p>
  
  <pre><code>module.exports = function (app, Uebersetzer) {
  
  
      app.post('/rest/uebersetzer', function (req, res) {
          var uebersetzer = req.body;
  
          console.log("before" + uebersetzer.zeit);
          uebersetzer.zeit = timeToMinutes(uebersetzer.zeit);
          console.log("after" + uebersetzer.zeit);
                  Uebersetzer.create(uebersetzer, function (err, result) {
                      res.json(result);
                  });
              }
          });
      });
      app.get("/rest/uebersetzer/:id", function (req, res) {
          Uebersetzer.findById(req.params.id, function (err, uebersetzer) {
              console.log("get uebersetzer by id before" + uebersetzer.zeit);
              uebersetzer.zeit = minutesToDate(uebersetzer.zeit);
              console.log("get uebersetzer by id " + uebersetzer.zeit);
              res.send(uebersetzer);
          });
  
  
      });
  
      function timeToMinutes(time) {
          var hours = time.getHours * 60;
          var minutes = time.getMinutes;
          time = hours + minutes;
          console.log(time);
          return time;
      }
      function minutesToDate(minutes) {
          var hours = Math.floor(minutes / 60);
          var minute = minutes % 60;
          var date = new Date(1, 1, 1970, hours, minute, 00);
          console.log(date);
          return date;
      }
  };
  </code></pre>
  
  <p>Uebersetzer.controller.js</p>
  
  <pre><code>(function () {
      angular
          .module("PassportApp")
          .controller("UebersetzerController", UebersetzerController);
  
      function UebersetzerController(UebersetzerService) {
          var vm = this;
          vm.addUebersetzer = addUebersetzer;
          vm.removeUebersetzer = removeUebersetzer;
          vm.selectUebersetzer = selectUebersetzer;
          vm.updateUebersetzer = updateUebersetzer;
          vm.uebersetzer = {};
  
          function updateUebersetzer(uebersetzer) {
              UebersetzerService.update(uebersetzer, function (response) {
                  findAllUebersetzers(setAllUebersetzer);
              });
          }
  
          function selectUebersetzer(uebersetzerId) {
              UebersetzerService.findUebersetzerById(uebersetzerId, function (response) {
                  vm.uebersetzer = response;
  
  
              });
          }
  
          function removeUebersetzer(uebersetzerId) {
              UebersetzerService.removeUebersetzer(uebersetzerId, function (response) {
                  findAllUebersetzers(setAllUebersetzers);
              });
          }
  
          function addUebersetzer(newUebersetzer) {
              UebersetzerService.createUebersetzer(newUebersetzer, function (response) {
                  findAllUebersetzers(setAllUebersetzers);
              });
          }
  
          function findAllUebersetzers(callback) {
              UebersetzerService.findAllUebersetzers(callback);
          }
  
          function setAllUebersetzers(uebersetzers) {
              vm.uebersetzers = uebersetzers;
          }
  
          findAllUebersetzers(setAllUebersetzers);
      }
  
  })();
  </code></pre>
  
  <p>Uebersetzer.html</p>
  
  <pre><code>&lt;h1&gt;Uebersetzer&lt;/h1&gt;
  &lt;table class="table table-striped"&gt;
      &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Sprache&lt;/th&gt;
          &lt;th&gt;Zeit&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;input ng-model="controller.uebersetzer.name" class="form-control" placeholder="Name" type="text"/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input ng-model="controller.uebersetzer.sprache" class="form-control" placeholder="Sprache" type="text"/&gt;
          &lt;td&gt;&lt;input ng-model="controller.uebersetzer.zeit" class="form-control" placeholder="Zeit" type="time"/&gt;
              &lt;button ng-click="controller.addUebersetzer(controller.uebersetzer)" class="btn btn-primary"&gt;
                  &lt;span class="glyphicon glyphicon-plus"&gt;&lt;/span&gt;
              &lt;/button&gt;
              &lt;button ng-click="controller.updateUebersetzer(controller.uebersetzer)" class="btn btn-success"&gt;
                  &lt;span class="glyphicon glyphicon-ok"&gt;&lt;/span&gt;
              &lt;/button&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;tr ng-repeat="uebersetzer in controller.uebersetzers"&gt;
          &lt;td&gt;{{uebersetzer.name}}&lt;/td&gt;
          &lt;td&gt;{{uebersetzer.sprache}}&lt;/td&gt;
          &lt;td&gt;{{uebersetzer.zeit|minDate|date:'HH:mm'}}&lt;/td&gt;
          &lt;td&gt;
              &lt;button ng-click="controller.removeUebersetzer(uebersetzer._id)" class="btn btn-danger"&gt;
                  &lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;
              &lt;/button&gt;
              &lt;button ng-click="controller.selectUebersetzer(uebersetzer._id)" class="btn btn-info"&gt;
                  &lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;
              &lt;/button&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I have "app.post" with two Console commands. The console.log shows me before my date ("before 1970-01-01T00: 11: 00.000Z"), but after conversion it just shows NaN. My role for this is timeToMinutes ().</p>
  
  <p>In "app.get" the minutes come from the database, and I change it into a date. My two give console.log "get uebersetzer by id before 100" and "get uebersetzer by id Sun June 24 1906 01:40:00 GMT + 0200 (Central European Summer Time)", but it is not in the input-field in html accepted, although the other data is written from the database in the fields (name and sprache).I hope it's not too much code or too little. I apologize for my bad english.</p>