I am getting the
last_login:"Thu, 09 Oct 2014 16:59:12 +0530" ,
In JSON data and I want to display it like "Oct,09". How to achieve this in AngularJS?
Can we do this using date filter ?
If Yes then how?
Can we do this using date filter ?
You can use date-filter like
In HTML Template Binding
{{ dateVariable| date : "MMM, dd"}}
In JavaScript
$filter('date')(dateVariable, "MMM, dd", timezone)
new Date(last_login), Then above will surely work.create a custom filter
app.filter('dateToISO', function() {
return function(input) {
input = new Date(input).toISOString();
return input;
};
call that custome filter to get the date in ISO format and format into desire format angular api for date
<div>
{{"Thu, 09 Oct 2014 16:59:12 +0530" | dateToISO | date:'MMM, yyyy'}} // filter date using
</div>