Tech Support Guy banner
  • Please post in our Community Feedback thread for help with the new forum software! If you are having trouble logging in, please Contact Us for assistance.
Status
Not open for further replies.
1 - 5 of 5 Posts

·
Registered
Joined
·
1,264 Posts
Discussion Starter · #1 ·
Hi everyone, I need a javascript countup that starts at 100MB and increases by 3MB per day and goes all the way up to 1000MB where it would then stop, anyone that can help with this?
 

·
Registered
Joined
·
6,052 Posts
server died on me, this should do it. The function i used it from here, other than that its simple math. $startdate is whenever you want it to start counting, that day will have 100 as its amount, format has to be month-day-year.

PHP:
<?php

function dateDiff($dformat, $endDate, $beginDate)
{
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}

$date = date('m-d-Y');
$startdate = "01-01-2007";
$startnum = 100;
$days = dateDiff("-", $date, $startdate);
$increase = $days * 3;
if($startnum + $increase < 1000)
$total = $startnum + $increase;
else
$total = 1000;

echo $total."mb";

?>
 
1 - 5 of 5 Posts
Status
Not open for further replies.
Top