I need calculate the future... mmm
I need add to actual time 300 seconds or 1000 or 3000 seconds and know the future time...
For example:
If the actual time is:
Day 1
Month 9
Year 07
Hour 01
Minuts 54
Seconds 17
add 60 seconds ...
Day 1
Month 9
Year 07
Hour 01
Minuts 55 ----> +60 seconds, no more 54.. its 55 now
Seconds 17
______________________________
I think do that...
PHP Code:
<?PHP
$more_seconds = 60;
$date = date("d");
$month = date("m");
$year = date("y");
$hours = date("H");
$minuts = date("i");
$seconds = date("s");
echo "day: $date, month: $month, year: $year, Hour: $hours:$minuts:$seconds";
$seconds = $seconds + $more_seconds;
while($seconds > 60){
$seconds = $seconds - 60;
$minuts = $minuts + 1;
}
while($minuts > 60){
$minuts = $minuts - 60;
$hours = $hours + 1;
}
while($hours > 24){
$hours = $hours - 24;
$date = $date + 1;
}
$ok = false;
while($ok == false){
if ($month == 1 OR $month == 3 OR $month == 5 OR $month == 7 OR $month == 8 OR $month == 10 OR $mont == 12){
if ($date > 31){
$date = $date - 31;
$month = $month + 1;
}
else
{
$ok = true;
}
}
if ($month == 4 OR $month == 6 OR $month == 9 OR $month == 11){
if ($date > 30){
$date = $date - 30;
$month = $month + 1;
}
else
{
$ok = true;
}
}
if ($month == 02){
if ($date > 28){
$date = $date - 28;
$month = $month + 1;
}
else
{
$ok = true;
}
}
if ($month > 12){
$month = $month - 12;
$year = $year + 1;
}
} //end $ok == false
echo "day: $date, month: $month, year: $year, Hour: $hours:$minuts:$seconds";
?>
But that script i make... i think have a error... "leap year years" in spanish "aņos biciestos"... anything can help me?