File: D:/HostingSpaces/SBogers10/douven.komma.pro/app/KommaApp/Kms/KmsService.php
<?php
/**
* Short description for the file.
*
* @copyright (c) 2012-2015, Komma
*/
namespace App\KommaApp\Kms;
class KmsService
{
public function calculateStartAndEndDate($year,$month,$day,$period = 'month'){
switch ($period){
case'month':
$start = new \DateTime("first day of " . $year . '-' . $month);
//Fist day of the month
$month++;
//check if the month is now 13
if ($month > 12) {
//yes reset to january and add one year
$month = 1;
$year++;
}
//first day of next month (at 00:00:00)
$end = new \DateTime("first day of " . $year . '-' . ($month));
break;
}
return ['start'=> $start, 'end'=> $end];
}
}