You can make use of
http://momentjs.com/[
^]
Sample code
var StartTime = moment("9:00 am", "hh:mm a");
var EndTime = moment("5:00 pm", "hh:mm a");
var Lunch = moment("0.30", "hh.mm");
var TotalTime = ((EndTime.subtract(StartTime)).subtract(Lunch)).format("hh.mm");
Regards..