Counting dates?
Posted: Sat Dec 23, 2006 12:40 am
I am wanting to calculate the difference between two dates then display that many textboxes. Can someone please tell me how I can achieve this? Thanks in advance.
This code is what I am working with:
This code is what I am working with:
Code: Select all
$now = time();
$lastDay = date("t", $now);
$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$thisMonth = date("F");
$thisYear = date("Y");
print "<select name=\"selectMonth\" id=\"selectMonth\">";
foreach($months as $v)
{
$selStr = $v == $thisMonth ? " selected=\"selected\"" : "";
print "<option value=\"$v\"$selStr>$v</option>";
}
print "</select>";
print "<select name=\"selectYear\" id=\"selectYear\">";
for($i=$thisYear; $i<$thisYear+30; $i++)
{
$selStr = $i == $thisYear ? " selected=\"selected\"" : "";
print "<option value=\"$i\"$selStr>$i</option>";
}
print "</select>";