banner ad
banner ad

Izračun plodnih dana

function ovpredct2_datechooser($name,$value=””)
{
$months=array(”,’January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,
‘September’,’October’,’November’,’December’);

if(empty($value)) $value=date(“Y-m-d”);

$parts=explode(“-“,$value);

$day=$parts[2]+0;
$month=$parts[1]+0;
$year=$parts[0];

$chooser=””;

$chooser.=” / “;

$chooser.=” / “;

$chooser.=” “;

return $chooser;
}

function ovpredct2_generate_html()
{
//construct the calculator page
$ovcalc=”

\n\n”;

if(!empty($_POST[‘calculator_ok’]))
{
//last cycle date
$date=”$_POST[dateyear]-$_POST[datemonth]-$_POST[dateday]”;

//convert to time
$lasttime=mktime(0,0,0,$_POST[datemonth],$_POST[dateday],$_POST[dateyear]);

//first fertile day
$firstdaytime=$lasttime + $_POST[days]*24*3600 – 16*24*3600;
$firstday=date(“F d, Y”,$firstdaytime);

//last fertile day
$lastdaytime=$lasttime + $_POST[days]*24*3600 – 12*24*3600;
$lastday=date(“F d, Y”,$lastdaytime);

//have to adjust due date?
$diff=$_POST[days] – 28;

//due date $date + 280 days
$duedatetime=$lasttime + 280*24*3600 + $diff*24*3600;
$duedate=date(“F d, Y”,$duedatetime);

//the result is here
$ovcalc.=’

Your estimated due date is ‘.$duedate.’

‘;

}
else
{
$ovcalc.=’

When was the first day of your last period?

‘.ovpredct2_datechooser(“date”,date(“Y-m-d”)).’

Usual number of days in your cycle:

‘;
}

return $ovcalc;
}

banner ad
banner ad
Close
error: Sadržaj je zaštiten !!