I am using angular ng-repeat to display an array of data including some columns which are dates but what is the best way to format the dates so they are presentable to the user? Thank you in advance.
DATES LOOK LIKE THIS IN VIEW 2016-01-14T08:00:00.000Z
WANT THIS FORMAT January 14, 2016
<td width="65%" class="joinedDate">{{user.created_at}}</td>
if you format like your date (January 14, 2016) you can use
<td width="65%" class="joinedDate">{{user.created_at | date:'MMMM dd, yyyy' }}</td>
OR
using date : 'medium' default date time like Oct 29, 2010 9:10:23 AM
<td width="65%" class="joinedDate">{{user.created_at |date:'medium'}}</td>
for more know https://docs.angularjs.org/api/ng/filter/date
You can use date filter
Try like this
<td width="65%" class="joinedDate">{{user.created_at | date:'MMM dd, yyyy' }}</td>
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With