$days = (strtotime(date("Y-m-d H:i:s")) - strtotime($date)) / (60 * 60 * 24);
$subtract = $days * 105;
$newAmount = 621350 - $subtract;
Ok. So here am I trying to do the exact same thing with AS3:
function countDays( startDate:Date, endDate:Date ):int
{
var oneDay:int = 24*60*60*1000; // hours*minutes*seconds*milliseconds
var diffDays:int = Math.round(Math.abs((startDate.getTime() - endDate.getTime())/(oneDay)));
return diffDays;
}
var today = new Date();
var startYear = 2011;
var startVal = 621350;
var currentYear = today.getFullYear();
var curHours = today.getHours();
var hourDiff = 24 - curHours;
var yearDiff = currentYear - startYear;
var subtract = yearDiff * 38400;
var newStartVal = startVal - subtract;
var days = countDays(today, new Date(2021, 12, 31));
var hoursInDays = days * 24;
var totalHours = hoursInDays - hourDiff;
var hoursIntoDays = totalHours/24;
newStartVal = newStartVal - (hoursIntoDays * 105);
So the PHP one will keep the counter up date by the second and that's what I'm trying to get to with the Actionscript one.
--
Greg

New Topic/Question
Reply



MultiQuote



|