Jul 24, 2015

[Solution] Get Hourly Time By Giving 24 Hour Time


Just Pass Your 24 hour Time to This Function It Will Return You The Desired Data.

eg 1300 - 1.00 PM
eg 0100 - 1.00 AM


function getHourlyTime(time){
    var Hours = parseInt(time / 100);
    var Minutes  = time % 100;
    if(Minutes <10){
        Minutes = '0'+Minutes;
    }
    if(Hours == 0){
        return '12:'+Minutes+' AM';
    }else if(Hours < 10){
        return '0'+Hours+':'+Minutes+' AM';
    }else if(Hours < 12){
        return Hours+':'+Minutes+' AM';
    }else if(Hours == 12){
        return '12:'+Minutes+' PM';
    }else{
        Hours = Hours -12;
        if(Hours < 10){
            return '0'+Hours+':'+Minutes+' PM';
        }else if(Hours < 12){
            return Hours+':'+Minutes+' PM';
        }
    }
}



Done By +Nifal Nizar

No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...