PHP Function to create Email Calendar Entry - Change to Full Day Event

Please see the below function that creates an email with a calendar entry for Outlook..

I need to change this to a full day event currently it adds over two days. Day one 01:00 - Day two 00:59 ?

function sendIcalEvent($from_name, $from_address, $to_name, $to_address, $to_auth_name, $to_auth_address, $startTime, $endTime, $type, $description, $location,$Uid,$status = false)
	ini_set('SMTP', 'SMTPREMOVED');
	$to = $to_address.",".$to_auth_address;
	if($type == "half"){
		$subject = "Holiday add Half Day - ".$to_name;
		$subject = "Holiday add - ".$to_name;
     //Need to add in the requestors name
		$subject = "Holiday remove - ".$to_name; //Need to add in the requestors name
	$organizer          = 'EMAILREMOVED';
    $organizer_email    = 'EMAILREMOVED';
    $location           = "Out Of Office";
    $date               = date("Ymd",strtotime($startTime));
    $startTime          = '0000';
    $endTime            = '2359';
    //$subject            = 'Millennium Falcon';
    $desc               = 'Holiday';
	$from  = "EMAILREMOVED";
	$headers = "From: $from\r\nReply-To: $from"; 
	$headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; name=calendar.ics; method=REQUEST; charset=\"iso-8859-1\"";
	$headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0"; 
    $message = "BEGIN:VCALENDAR\r\n";
    $message .= "VERSION:2.0\r\n";
    $message .= "PRODID:-//Deathstar-mailer//theforce/NONSGML v1.0//EN\r\n";
		$message .= 'METHOD:CANCEL' . "\r\n";
		$message .= 'STATUS:CANCELLED'. "\r\n";		
		$message .= 'METHOD:REQUEST' . "\r\n";
    $message .= "BEGIN:VEVENT\r\n";
    $message .= "UID:" . $Uid ."\r\n";
    $message .= "DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z\r\n";
    $message .= "DTSTART:".$date."T".$startTime."00Z\r\n";
    $message .= "DTEND:".$date."T".$endTime."00Z\r\n";
    $message .= "SUMMARY:".$subject."\r\n";
    $message .= "ORGANIZER;CN=".$organizer.":mailto:".$organizer_email."\r\n";
    $message .= "LOCATION:".$location."\r\n";
    $message .= "DESCRIPTION:".$desc."\r\n";
    $message .= "END:VEVENT\r\n";
    $message .= "END:VCALENDAR\r\n";
    $headers .= $message;
    mail($to, $subject, $message, $headers); 

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Try this
$message .= "DTSTART;VALUE=DATE:{$date}\r\n";
$message .= "DTEND;VALUE=DATE:{$date}\r\n";

Open in new window

According to the docs if you specify the type of the DTSTART as a date and leave out the End Date with Start Date being a date only (no time) then it will load as an all day event.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.