rendered paste bodypublic String getDuration()
{
Date theDate = new Date(Long.valueOf(preTime).longValue());
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
dateString = formatter.format(theDate);
long ldate = System.currentTimeMillis();
BigInteger localDate = BigInteger.valueOf(ldate);
long llong = Long.valueOf(preTime).longValue();
BigInteger preDate = BigInteger.valueOf(llong);
BigInteger c = localDate.subtract(preDate);
long thousand = 1000;
BigInteger kou = BigInteger.valueOf(thousand);
BigInteger days = c.divide(kou);
int myDays, myHours, myMinutes, mySeconds, myWeeks, myMonths;
int seconds = days.intValue();
seconds2 = c.intValue(); // this is for precheck, do we need 2?
myMonths = seconds / 2629743;
seconds = seconds - (myMonths * 2629743);
myWeeks = seconds / 604800;
seconds = seconds - (myWeeks * 604800);
myDays = seconds / 86400;
seconds = seconds - (myDays * 86400);
myHours = seconds / 3600;
seconds = seconds - (myHours * 3600);
myMinutes = seconds / 60;
seconds = seconds - (myMinutes * 60);
mySeconds = seconds;
if(myMonths>0) {
preDuration = myMonths + "m " + myWeeks + "w " + myDays + "d " + myHours + "h " + myMinutes + "m " + mySeconds + "s";
} else if(myWeeks>0) {
preDuration = myWeeks + "w " + myDays + "d " + myHours + "h " + myMinutes + "m " + mySeconds + "s";
} else if(myDays>0) {
preDuration = myDays + "d " + myHours + "h " + myMinutes + "m " + mySeconds + "s";
} else if(myHours>0) {
preDuration = myHours + "h " + myMinutes + "m " + mySeconds + "s";
} else if(myMinutes>0) {
preDuration = myMinutes + "m " + mySeconds + "s";
} else if(mySeconds>0) {
preDuration = mySeconds + "s";
}
return preDuration;
}