How to get Current Date time

angularjs, datetime, javascript, jquery

Solution

Define getDatetime method on scope

scope.getDatetime = function() {
  return (new Date).toLocaleFormat("%A, %B %e, %Y");
};

Then in template:

<b>{{getDatetime()}}</b>

Doc to format date https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleFormat

Problem

How can I get current date and time in `angularjs` I have tried the following: ``` <b>{{Date.Now}}</b> ``` But it doesn't work. Any suggestions would be appreciated.

Original source