adaugare string
Moderatori: Zamolxe, Moderatori
- vectorialpx
- Senior Member
- Mesaje: 4832
- Membru din: Mar Mar 01, 2005 9:48 am
- Localitate: Bucuresti
- Contact:
- vectorialpx
- Senior Member
- Mesaje: 4832
- Membru din: Mar Mar 01, 2005 9:48 am
- Localitate: Bucuresti
- Contact:
- vectorialpx
- Senior Member
- Mesaje: 4832
- Membru din: Mar Mar 01, 2005 9:48 am
- Localitate: Bucuresti
- Contact:
MULTUMESC. Uitati ce am gasit eu si ce o sa folosesc cred care ma scuteste de multa munca.
function fnc_date_calc($this_date,$num_days){
$my_time = strtotime ($this_date); //converts date string to UNIX timestamp
$timestamp = ($num_days * 86400) + $my_time; //calculates # of days passed ($num_days) * # seconds in a day (86400)
$return_date = date("Y-m-d",$timestamp); //puts the UNIX timestamp back into string format
return $return_date;//exit function and return string
}//end of function
$data = date("Y-m-d");
print''.$data;
$date_to_test = "$data";
$days_to_add = $_POST[RadioGroup1];
//$past_date = fnc_date_calc($date_to_test,(($days_to_add)*-1));
$future_date = fnc_date_calc($date_to_test,$days_to_add);
echo "Test Date is: ".$date_to_test;
echo "<br>";
echo "Number of days to Calculate is: ".$days_to_add;
echo "<br>";
/*echo "Past date is: ".$past_date;
echo "<br>";*/
echo "Future date is: ".$future_date;
function fnc_date_calc($this_date,$num_days){
$my_time = strtotime ($this_date); //converts date string to UNIX timestamp
$timestamp = ($num_days * 86400) + $my_time; //calculates # of days passed ($num_days) * # seconds in a day (86400)
$return_date = date("Y-m-d",$timestamp); //puts the UNIX timestamp back into string format
return $return_date;//exit function and return string
}//end of function
$data = date("Y-m-d");
print''.$data;
$date_to_test = "$data";
$days_to_add = $_POST[RadioGroup1];
//$past_date = fnc_date_calc($date_to_test,(($days_to_add)*-1));
$future_date = fnc_date_calc($date_to_test,$days_to_add);
echo "Test Date is: ".$date_to_test;
echo "<br>";
echo "Number of days to Calculate is: ".$days_to_add;
echo "<br>";
/*echo "Past date is: ".$past_date;
echo "<br>";*/
echo "Future date is: ".$future_date;
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 21 vizitatori
