I have a database of events... and I need to add a row for each day for a year... so there will be 365 rows in the database, but the date format must be as follows:

Row 1
Start Date: 2012-01-01T00:00
End Date: 2012-01-01T23:59

Row 2
Start Date: 2012-01-02T00:00
End Date: 2012-01-02T23:59

so... Y-m-d...

But im not sure on how to make the script work out the days in each month etc... Can someone help? Im inserting them into a table called events

Thanks Dan

Solved :)

$itotal = 365;
$now = "1325289600";

$allDay = 1;
$eventName = "";
$newCalID = 4;
for ($i = 0; $i <= $itotal; $i++) {
    $startTime = date("Y-m-d", strtotime("+1 day", $now)) . "T00:00";
	$endTime = date("Y-m-d", strtotime("+1 day", $now)) . "T23:59";
	echo "INSERT INTO `events` (eventSummary, eventStart, eventEnd, eventAllDay) VALUES ('$eventName','$startTime','$endTime','$allDay');<br>";
	echo "<br /><br />";
	$now = strtotime("+1 day", $now);

make effery month 31 day's and than use
checkdate on it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.