Added functions to get first and last day of the year.
This commit is contained in:
@@ -106,6 +106,26 @@ function endOfMonth($year, $month, $format='d.m.Y') {
|
||||
->endOfMonth()->format($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first day of a given year.
|
||||
*
|
||||
* @param string $year
|
||||
* @return string E. g. 01.01.2018
|
||||
*/
|
||||
function firstDayOfYear($year, $format='d.m.Y') {
|
||||
return Carbon\Carbon::parse('01.01.' . $year)->format($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last day of a given year.
|
||||
*
|
||||
* @param string $year
|
||||
* @return string E. g. 31.12.2018
|
||||
*/
|
||||
function lastDayOfYear($year, $format='d.m.Y') {
|
||||
return Carbon\Carbon::parse('31.12.' . $year)->format($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check, if all fields of an array are null.
|
||||
* Returns true, if all fields of $array are null. Returns fals,e otherwise
|
||||
|
||||
Reference in New Issue
Block a user