You are here

protected function statspro::get_last_day_of_month_from_reference in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 statspro.inc \StatsPro::get_last_day_of_month_from_reference()

Returns a YYYYMMDD date representation of the last day of same the month as the reference day.

Parameters

<int> $reference A timestamp representaing the reference day.:

Return value

<int> Last day of the same month of the reference day.

1 call to statspro::get_last_day_of_month_from_reference()
statspro::get_month_from_reference in ./statspro.inc
Returns a SQL WHERE for the selected month.

File

./statspro.inc, line 265
statspro class for statistics pro module.

Class

statspro
Manages the data saving and retrieval according to the user defined parameters.

Code

protected function get_last_day_of_month_from_reference($reference) {
  $year = date('Y', $reference);
  $month = date('m', $reference);
  $last = $month == 12 ? $year . '-12-31' : sprintf('%04u-%02u-00', $year, $month + 1);
  $last = date('Ymd', strtotime($last));
  return $last;
}