guagay_wk
guagay_wk

Reputation: 28060

Convert this angularjs datetime format to a shorter one

I have a table with one of the columns showing datetime value. I am using angularjs ngtable module.

<div ng-controller="TestCtrl" class="container">
    <table ng-table="tableParams" class="table table-bordered">
        <thead>
        <tr>
            <th>name</th>
            <th>date</th>
        </tr>
        </thead>

        <tbody>
        <tr ng-repeat="test in $data">
            <td data-title="'name'" >
                {{test.name}}
            </td>
            <td data-title="'remarks'">
                {{test.date}}
            </td>
        </tr>
        </tbody>
    </table>
</div>

An example of {{test.date}} looks something like 2015-12-08T16:00:00.000Z. I would like to convert it to Dec08 16:00:00. How can this be done in angularjs?

Upvotes: 3

Views: 136

Answers (1)

CaptainMat
CaptainMat

Reputation: 148

yes, in Angular doc you have examples: Link

try something like: {{test.name | date:'MMMdd HH:mm:ss'}}

Upvotes: 5

Related Questions