Skip to main content

AngularJS Get Current Date Time Example

Today, We want to share with you AngularJS Get Current Date Time Example.In this post we will show you AngularJS: Get and display Current Date and Time , hear for get current time in angularjs controller we will give you demo and example for implement.In this post, we will learn about get current date in angularjs controller with an example.

AngularJS Get Current Date Time Example

There are the Following The simple About AngularJS Get Current Date Time Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop javascript – Angularjs – display current date, so the angularjs get current Date and Time for this example is following below.

Also Read :  Install WhatsApp web On iPad Without iPhone Tutorials

Example 1: Angularjs – display current date

controller

function pakainfoCtrl($scope)
{
    $scope.date = new Date();
}

view files

<div ng-app ng-controller="pakainfoCtrl">
    {{date | date:'yyyy-MM-dd'}}
</div>

Example 2 : AngularJS Get Current Date Time Example

AngularJS Template

<h3>Get current date using angularjs - JavaScript</h3>
<span date-now="MM/dd/yyyy"></span>
<a href="https://pakainfo.com/" target="_blank" alt="pakainfo" title="pakainfo">Free Download Example - Pakainfo.com</a>

AngularJS Directive

.directive('dateNow', ['$filter', function($filter) {
  return {
    link: function( $scope, $element, $attrs) {
      $element.text($filter('date')(new Date(), $attrs.dateNow));
    }
  };
}])

Example 3: format date in angularjs controller

Angularjs Get Current Date or Time or DateTime with Example

 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pakainfo.com - Get Current Date Time in Angularjs</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script type="text/javascript">
var pakaApp = angular.module('pakaApp', [])
pakaApp.controller('mydateController', function ($scope) {
$scope.currentDate = new Date();
});
</script>
</head>
<body data-ng-app="pakaApp" data-ng-controller="mydateController">
<form id="pakaform">
<a href="https://pakainfo.com/" target="_blank" alt="pakainfo" title="pakainfo">Free Download Example - Pakainfo.com</a>

<div>
	Live Date Time:<b> {{currentDate | date:'dd/MM/yyyy hh:mm:ss a'}}</b><br />
	Live Date :<b>{{currentDate | date:'dd/MM/yyyy'}}</b><br />
	Live Time :<b>{{currentDate | date:'hh:mm:ss a'}}</b>
</div>
</form>
</body>
</html>

Angular 6 CRUD Operations Application Tutorials

Read :

Also Read :  jQuery Show Popup Message Few Seconds then hide

Related Search :angular 4 get current date, get current date in angularjs controller, get current time in angularjs controller, angular 2 get current date, angular 5 get current date, angular 4 current date, angularjs get current year, format date in angularjs controller, Angular Js Get Current Date Time Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about AngularJS Get Current Date Time Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Web Developer

Hi, I’m Web developer, PHP developer.Pakainfo.com is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]