function getTimeString(givenDate) {
var monthNames = new Array();
monthNames[0] = "January";
monthNames[1] = "February";
monthNames[2] = "March";
monthNames[3] = "April";
monthNames[4] = "May";
monthNames[5] = "June";
monthNames[6] = "July";
monthNames[7] = "August";
monthNames[8] = "September";
monthNames[9] = "October";
monthNames[10] = "November";
monthNames[11] = "December";
var previousDate=new Date(givenDate);
var currentDate=new Date();
var milliSeconds=currentDate.getTime()-previousDate.getTime();
var daysDifference = Math.floor(milliSeconds/1000/60/60/24);
var timeDiffernceText="";
if( daysDifference ==0)
{
milliSeconds -= daysDifference*1000*60*60*24
var hoursDifference = Math.floor(milliSeconds/1000/60/60);
if(hoursDifference==0)
{
milliSeconds -= hoursDifference*1000*60*60
var minutesDifference = Math.floor(difference/1000/60);
timeDiffernceText=minutesDifference.toString();
timeDiffernceText=timeDiffernceText + " Minutes";
}
else
{
timeDiffernceText=hoursDifference.toString();
timeDiffernceText=timeDiffernceText+" Hours";
}
}
else
{
var month=previousDate.getMonth();
timeDiffernceText=monthNames[month];
timeDiffernceText=timeDiffernceText+" "+ previousDate.getDate().toString();
}
return timeDiffernceText;
}
var monthNames = new Array();
monthNames[0] = "January";
monthNames[1] = "February";
monthNames[2] = "March";
monthNames[3] = "April";
monthNames[4] = "May";
monthNames[5] = "June";
monthNames[6] = "July";
monthNames[7] = "August";
monthNames[8] = "September";
monthNames[9] = "October";
monthNames[10] = "November";
monthNames[11] = "December";
var previousDate=new Date(givenDate);
var currentDate=new Date();
var milliSeconds=currentDate.getTime()-previousDate.getTime();
var daysDifference = Math.floor(milliSeconds/1000/60/60/24);
var timeDiffernceText="";
if( daysDifference ==0)
{
milliSeconds -= daysDifference*1000*60*60*24
var hoursDifference = Math.floor(milliSeconds/1000/60/60);
if(hoursDifference==0)
{
milliSeconds -= hoursDifference*1000*60*60
var minutesDifference = Math.floor(difference/1000/60);
timeDiffernceText=minutesDifference.toString();
timeDiffernceText=timeDiffernceText + " Minutes";
}
else
{
timeDiffernceText=hoursDifference.toString();
timeDiffernceText=timeDiffernceText+" Hours";
}
}
else
{
var month=previousDate.getMonth();
timeDiffernceText=monthNames[month];
timeDiffernceText=timeDiffernceText+" "+ previousDate.getDate().toString();
}
return timeDiffernceText;
}