Skip to content Skip to sidebar Skip to footer

Extract Time From Datetime Using Angular Js

I need to extract the hour and minute from the datetime(eg:2013-09-03 05:02:04) using Angular js.I have done like this. JSON Data: { 'status': 'success', 'data': [

Solution 1:

I think the issue might be related to the angular date filter supporting only ISO8601 compliant date string formats. You can simply convert your date string to a date object.

<td class="priority_time">
    {{getDateObject(priority.PriorityPassReservation.reservation_dt) | 
    date:' h:mm'}}
</td>

In your controller:

$scope.getDateObject = function(dt){
    /* convert to date object *//* return new Date(2013,8,3,5,2,4); */
}

Solution 2:

Post a Comment for "Extract Time From Datetime Using Angular Js"