Ovulation Calculator

You can enter the first day of your last menstrual period in order to calculate your ovulation and increase the chances of getting pregnant.

/* This calculator is your for free by Calendarscripts.info. You have no obligations for anything - you can modify, redistribute, sell it or whatever you want to do.
We will appreciate if you don't remove the link at the bottom, but that's not required. */

/* Feel free to modify the CSS and the texts below. - no problem at all. Just don't touch the PHP code or the specual codes which are surrounded with %% unless you know what you are doing. */

/* Version 1.1 released on Nov 7, 2011*/
?>

//last cycle date
$date="$_POST[dateyear]-$_POST[datemonth]-$_POST[dateday]";

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

// next period start
$next_period=$lasttime + $_POST['days']*24*3600;
$next_period=date("F d, Y",$next_period);

//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);

?>

Here are the results based on the information you provided:
Your next menstrual period is expected to start on .
You next most fertile period is to .
If you conceive within this timeframe, your estimated due date will be .






Please select the first day of your last menstrual period:
Usual number of days in your period:

//to print a date chooser - get name and value in mysql date format
function date_chooser($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;
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>