PDA

View Full Version : strtotime problem

Taylor_1978
07-12-2005, 03:52 PM
Ok.. here is my code:

\$date = time();

if (!isset(\$t_day)) {

\$t_day = date('M j, Y',\$date);
}

print '<h3>Create Tournament</h3>';
print '<a href=?module=tournaments&mode=calendar>Upcoming Tournaments</a> | <a href=?module=tournaments&mode=guide>Tournament Guide</a> | <b>Create Tournament</b>';
print '<br><br>';

/* START DAY SELECTION */

\$selectbox2.= '<option value="'.\$t_day.'">'.\$t_day.'</option>';

\$getdate = date("M j, Y",\$date);
for(\$count = 1; \$count <= 60; \$count++ ) {

\$selectbox2.= '<option value="'.\$getdate.'">'.\$getdate.'</option>';

\$newdate = strtotime(\$getdate . ' + 1 day');
\$getdate = date('M j, Y', \$newdate);

}
/* END DAY SELECTION */

/* START TIME SELECTION */

\$check1 = \$t_day;
\$check2 = strtotime(\$t_day);
\$check2 = date("h:ia",\$check2);

while (\$check1 == \$t_day) {

\$getdate1 = date("h:ia",\$check2);
\$getdate2 = date("H:i",\$check2);

\$selectbox3.= '<option value="'.\$getdate2.'">'.\$getdate1.'</option>';

\$check2 = strtotime(\$getdate1 . ' + 15 minutes');
\$check1 = date('M j, Y', \$check2);

}
/* END TIME SELECTION */

print 'Select Date: <select name=t_day onChange="if(this.options[this.selectedIndex].value) window.location=\'?module=tournaments&mode=create&t_day=\'+this.options[this.selectedIndex].value;">'.\$selectbox2.'</select><p>';
print 'Select Time: <select name=time>'.\$selectbox3.'</select>';

For some reason, this is outputting in the 2nd select box from 11am to 11.45pm instead of 12.00am to 11.45pm. I'm not quite sure why :(

Any idea's?

Taylor.

Taylor_1978
07-12-2005, 03:58 PM
SORRY!

Just found problem... I was setting date of \$check2 twice.

Unfortunately, being in Melbourne, Australia and the middle of winter I don't have the heat as an excuse like NancyJ.

LOL

:thumbsup: