How to get Current Date and Time in AngularJS?

  • 05-04-2022
  • 824
  • Angular JS
  • Haresh Chauhan

In this example, I will you show how to get the current date and time in the angular js we will learn how to make this and how to use the angular application with a specific date format. you can use date format like yyyy-mm-dd, dd/mm/yyyy, mm-dd-yyyy hh:mm:ss and many more formats you can use as per your need. Now we will make this example using angular js ng-bind directive.

So, now you can follow bellow simple we are getting time and date from the date object in this example. So, You can see the example and make it.


{{ 'Date Object' | date: 'Date Format' }}

{{ CurrentDate | date: 'dd/MM/yyyy' }}

Example : index.html

<!doctype html>
    <title>How to get Current Date and Time in AngularJS? -</title>
    <script src=""></script>

<body ng-app="MyApp">
    <div ng-controller="AppCtrl">
        <p>{{ CurrentDate | date:'MM/dd/yyyy'}}</p>
        <p>{{ CurrentDate | date:'dd/MM/yyyy'}}</p>
        <p>{{ CurrentDate | date:'dd/MM/yyyy HH:mm:ss'}}</p>

<script type="text/javascript">
    var app = angular.module('MyApp', []);
    app.controller('AppCtrl', ['$scope', '$http', function($scope, $http) {
        $scope.CurrentDate = new Date();

I hope you like this article.


We always thanks to you for reading our blogs.


Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us


Haresh Chauhan


We Are Also Recommending You :