I asume ur inputting the time at a string since you have AM and PM ... this is a bad idea if you ask me but since that's what you have ill just try to awnser on it.
You would first have to split the string, and add 12 hours if you are on PM, then do time2 - time1 for the difrence...
trace(timedif("1 AM", "3 PM"));
function timedif(string1:String, string2:String){
var time1 = string1.split(" ");
var time2 = string2.split(" ");
var newtime1:int = time1[0];
var newtime2:int = time2[0];
if(time1[1] == "PM"){ newtime1 = newtime1 + 12; }
if(time2[1] == "PM"){ newtime2 = newtime2 + 12; }
var difrence = newtime2 - newtime1;
return difrence;
}
I beleive this is the awnser to your question, i'm not saying its a good solution