Used by Spring MVC + Angular.
There is a sign of users in html:
...<thead> <tr> <th>ID</th> <th>NAME</th> <th>AGE</th> <th>ADMIN</th> <th>CREATED_DATE</th> <th width="100"></th> <th width="100"></th> </tr> </thead> <tbody> <tr ng-repeat="u in ctrl.getAllUsers()"> <td>{{u.id}}</td> <td>{{u.name}}</td> <td>{{u.age}}</td> <td>{{u.admin}}</td> <body> <td>getDate({{u.createdDate}})</td> </body> <script> function getDate(timestamp) { return new Date(timestamp * 1e3).toISOString().slice(-13, -5); } </script> <td> <button type="button" ng-click="ctrl.editUser(u.id)" class="btn btn-success custom-width"> Edit </button> </td>... the ctrl.getAllUsers method refers to the Controller of the returning users and, accordingly, in the cycle displays information about each user. But the value of u.createdDate is unix timestamp. I would like to display in more readable form. To do this, in the html page declared the script:
<script> function getDate(timestamp) { return new Date(timestamp * 1e3).toISOString().slice(-13, -5); } </script> and tried to call him:
<body> <td>getDate({{u.createdDate}})</td> </body> But it displays the value of the string itself.
Tell me, how can I call a function and display the parameter returned to it?
PS I understand the technology of the front badly, maybe there are more correct ways to display the time in the correct format, when the timestamp value comes from the server