Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 445
guagay_wk Avatar asked Jun 04 '26 18:06

guagay_wk


1 Answers

yes, in Angular doc you have examples: Link

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

like image 57
CaptainMat Avatar answered Jun 06 '26 09:06

CaptainMat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!