I am displaying date in this format using angular
{{ date }} ,date:\'MM-dd-yyyy HH:MM:ss\
how to display like Jan-dd-yyyy
using angular
Is there any dirct way to do using angular js- (Using normal jquery i am able to do)
I am displaying date in this format using angular
{{ date }} ,date:\'MM-dd-yyyy HH:MM:ss\
how to display like Jan-dd-yyyy
using angular
Is there any dirct way to do using angular js- (Using normal jquery i am able to do)
Share Improve this question asked Jul 17, 2013 at 7:44 PrashobhPrashobh 9,54215 gold badges64 silver badges91 bronze badges 2- Please refer this link friend docs.angularjs.org/api/ng.filter:date may be this one help you – snowp Commented Jul 17, 2013 at 7:49
- Hi i created some custom filters and updated here angulartutorial.net/2014/04/… – Prashobh Commented Apr 23, 2015 at 6:51
4 Answers
Reset to default 11use Angular filter of date.
{{date | date:'MM-dd-yyyy HH:MM:ss'}}
See the following link.
http://docs.angularjs.org/api/ng.filter:date
Well,
according to the docs, you have a builtin filter in angular, called date
:
<p>{{Date.now() | date:'yyyy'}}
would render to:
<p>2013</p>
The yyyy
in this case can be any format string documented. In the example you gave, this would be:
{{date | date: 'MMM-dd-yyyy'}} # => "Jan-21-2013" (if date was a date object for this day)
For custom date:
$scope.user.dob = new Date('1980', '12' ,'10'); // controller code
{{user.dob | date : 'MMM-dd-yyyy'}} // Dec-10-1980
For current date:
$scope.user.current= new Date(); // controller code
{{user.current | date : 'MMM-dd-yyyy'}} // Current date in given format
Try this
{{ date }} ,date:\'MMM-dd-yyyy HH:MM:ss\