[SalesForce] get apex controller value in lightning component controller

I have created apex controller which is returning List<sObject> as

apex controller:

@AuraEnabled

public static  List<TimeSheet__c> getDetailTimeSpendInWeek_ctrl(string selectedDate){
    System.debug(selectedDate);
    string soql;
    string commaSepratedFields = 'Id, startTime__c, EndTime__c, TaskName__c, ProjectName__c, TimeDuration__c';
    string objectTypeName = 'TimeSheet__c';
    if(selectedDate == null){
        soql= 'SELECT ' + commaSepratedFields + ' FROM ' + objectTypeName + ' WHERE EntryDate__c = TODAY ';
    }else{
        date pickedDate = Date.valueOf(selectedDate);
        soql= 'SELECT ' + commaSepratedFields + ' FROM ' + objectTypeName + ' WHERE EntryDate__c = :pickedDate ';
    }
    List<TimeSheet__c> lstTimeSheet = new List<TimeSheet__c>();
    lstTimeSheet = Database.Query(soql);
    System.debug(lstTimeSheet);
    return lstTimeSheet;
}

component code:

<table class="slds-table slds-table--bordered slds-table--cell-buffer">
                       <tbody>
                         <aura:iteration items="{!v.weeklyReport}" var="rep">
                           <tr>
                               <td>
                                   <div class="slds-truncate" >{!rep.StartTime__c}</div>
                                   <div class="slds-truncate" >{!rep.EndTime__c} </div>
                                </td>
                                <td>
                                    <div class="slds-truncate">{!rep.TaskName__c}</div>
                                    <div class="slds-truncate">{!rep.ProjectName__c}</div>
                                </td>
                               <td>
                                   <div class="slds-truncate">{!rep.TimeDuration__c} </div>
                               </td>
                            </tr>
                         </aura:iteration>
                        </tbody>
       </table>

but the time starttime and end time value is coming in milliseconds , so i want to manipulate the values and convert it into HH:MM format.

please help me how can i get these values in component controller.

JS Helper:

 var action2 = component.get('c.getDetailTimeSpendInWeek_ctrl'); 
    action2.setCallback(this, function(response) {
    var state = response.getState();
    if (state == "SUCCESS") {
        var report = response.getReturnValue();

    $A.enqueueAction(action2);

}

Best Answer

If the problem is how to present the values appropriately then try some variation of lightning:formattedDateTime in your .cmp:

<lightning:formattedDateTime value="{!rep.StartTime__c}"
        year="numeric"
        month="numeric"
        day="numeric"
        hour="2-digit"
        minute="2-digit"
        second="2-digit"
        timeZone="{! $Locale.timezone }"
        />

If you want to do some calculation in your JavaScript controller, then you can convert to a JavaScript Date object using:

var ms = ...;
var d = new Date(ms);