title: Get the time my page started running angularjs
body: <p>I am making an app displaying the current system time but I want to get the time my page started running so I can calculate and display the time that my page is up and running. I am using angularjs and currently has no idea on how can I get this. I have my code on getting the current system time like this</p>
  
  <pre><code> Current time is:
        &lt;span my-current-time="format1"&gt;&lt;/span&gt;
        &lt;span my-current-time="format"&gt;&lt;/span&gt; :
        &lt;span my-current-time="format3"&gt;&lt;/span&gt; :
        &lt;span my-current-time="format4"&gt;&lt;/span&gt; 
        &lt;span my-current-time="format5"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>with this script</p>
  
  <pre><code> $scope.format1 = 'M/d/yy  ';
        $scope.format = 'h';
        $scope.format3 = 'mm';
        $scope.format4 = 'ss';
        $scope.format5 = 'a';
        $scope.format2 = 'Z ';
  </code></pre>
  
  <p>and a directive like this</p>
  
  <pre><code>.directive("myCurrentTime", function(dateFilter) {
              return function(scope, element, attrs) {
                var format;
                  scope.$watch(attrs.myCurrentTime, function(value) {
                    format = value;
                    updateTime();
  
                  });
                function updateTime() {
                  var dt = dateFilter(new Date(), format );
                           element.text(dt);
                        }
  
                        function updateLater() {
                          setTimeout(function() {
                            updateTime(); // update DOM
                            updateLater(); // schedule another update
                          }, 1000);
                        }
  
                        updateLater();
                      }
                    });
  </code></pre>
  
  <p>I just want to display the total hours my page is currently running</p>