Reputation: 4814
I have a date like this
2019-02-15 16:01:18
and i am trying to show this in following format:
Feb 2, 2019 4:01 PM
How can i achive this with date filter: here is what i tried:
{{ myDate | date:'MMM d, yyyy hh:mm' }}
Upvotes: 1
Views: 1277
Reputation: 412
From your comments it appears you are starting with a String
, not a Date
.
var dateString = "2019-02-15 16:01:18";
$scope.myDate = new Date(dateString);
Then you can use the date filter as you have tried:
{{ myDate | date:'MMM d, yyyy hh:mm' }}
Upvotes: 1