function calc_timeframe() { $debug = false; $this->timeframe_start = mktime(0, 0, 0, $this->month, 1, $this->year); $this->timeframe_end = mktime(0, 0, 0, $this->month + 1, 1, $this->year); parent::calc_timeframe(); }
function calc_timeframe() { $debug = FALSE; $this->timeframe_start = mktime(0, 0, 0, $this->month, 1, $this->year); $this->timeframe_end = mktime(0, 0, 0, $this->month + 3, 1, $this->year) - 86400; $this->start_timestamp = date('Y-m-d', $this->timeframe_start); $this->end_timestamp = date('Y-m-d', $this->timeframe_end - 86400); //Initial cohort $this->cohort_timestamp[$this->period]['baseline_start'] = mktime(0, 0, 0, $this->month - $this->period, 1, $this->year); $this->cohort_timestamp[$this->period]['baseline_stop'] = mktime(0, 0, 0, $this->month - $this->period + 1, 1, $this->year) - 86400; $this->cohort_timestamp[$this->period]['baseline_mid_start'] = mktime(0, 0, 0, $this->month - $this->period + 1, 1, $this->year); $this->cohort_timestamp[$this->period]['baseline_mid_stop'] = mktime(0, 0, 0, $this->month - $this->period + 2, 1, $this->year) - 86400; $this->cohort_timestamp[$this->period]['baseline_end_start'] = mktime(0, 0, 0, $this->month - $this->period + 2, 1, $this->year); $this->cohort_timestamp[$this->period]['baseline_end_stop'] = mktime(0, 0, 0, $this->month - $this->period + 3, 1, $this->year) - 86400; //Follow up cohort $this->cohort_timestamp[$this->period]['follow_up_start'] = mktime(0, 0, 0, $this->month, 1, $this->year); $this->cohort_timestamp[$this->period]['follow_up_stop'] = mktime(0, 0, 0, $this->month + 1, 1, $this->year) - 86400; $this->cohort_timestamp[$this->period]['follow_up_mid_start'] = mktime(0, 0, 0, $this->month + 1, 1, $this->year); $this->cohort_timestamp[$this->period]['follow_up_mid_stop'] = mktime(0, 0, 0, $this->month + 2, 1, $this->year) - 86400; $this->cohort_timestamp[$this->period]['follow_up_end_start'] = mktime(0, 0, 0, $this->month + 2, 1, $this->year); $this->cohort_timestamp[$this->period]['follow_up_end_stop'] = mktime(0, 0, 0, $this->month + 3, 1, $this->year); if ($debug) { foreach ($this->cohort_timestamp[$this->period] as $var) { echo date('Y-m-d', $var) . "<br>"; } } parent::calc_timeframe(); }
function calc_timeframe() { $debug = false; $this->timeframe_start = mktime(0, 0, 0, 1, 1, $this->year_start); $this->timeframe_end = mktime(0, 0, 0, 1, 1, $this->year_end + 1); $this->year_count = $this->year_end - $this->year_start; for ($i = 0; $i <= $this->year_count; $i++) { $this->years[$this->year_start + $i]['start'] = mktime(0, 0, 0, 1, 1, $this->year_start + $i); $this->years[$this->year_start + $i]['end'] = mktime(0, 0, 0, 1, 1, $this->year_start + 1 + $i); for ($j = 1; $j <= 12; $j++) { $this->months[$this->year_start + $i][$j]['start'] = mktime(0, 0, 0, $j, 1, $this->year_start + $i); $this->months[$this->year_start + $i][$j]['end'] = mktime(0, 0, 0, $j + 1, 1, $this->year_start + $i); } } if ($debug) { echo "year_count:" . $this->year_count . "<br>"; echo "year_start:" . $this->year_start . "<br>"; echo "year_end:" . $this->year_end . "<br>"; for ($i = 0; $i <= $this->year_count; $i++) { echo date('Y-m-d', $this->years[$this->year_start + $i]['start']) . "<br>"; echo date('Y-m-d', $this->years[$this->year_start + $i]['end']) . "<br>"; echo "-----------------------<br>"; echo date('Y-m-d', $this->months[$this->year_start + $i][1]['start']) . "<br>"; echo date('Y-m-d', $this->months[$this->year_start + $i][1]['end']) . "<br>"; echo "-----------------------<br>"; } } parent::calc_timeframe(); }
function calc_timeframe() { $debug = false; $this->timeframe_start = mktime(0, 0, 0, $this->month, 1, $this->year); $this->timeframe_end = mktime(0, 0, 0, $this->month + 3, 1, $this->year) - 86400; $this->start_timestamp = date('Y-m-d', $this->timeframe_start); $this->end_timestamp = date('Y-m-d', $this->timeframe_end - 86400); $this->cohort_timestamp[6]['baseline_start'] = mktime(0, 0, 0, $this->month - 7 + $this->nr_6, 1, $this->year); $this->cohort_timestamp[6]['baseline_stop'] = mktime(0, 0, 0, $this->month - 6 + $this->nr_6, 1, $this->year); $this->cohort_timestamp[6]['end_cohort_start'] = mktime(0, 0, 0, $this->month - 1 + $this->nr_6, 1, $this->year); $this->cohort_timestamp[6]['end_cohort_stop'] = mktime(0, 0, 0, $this->month + $this->nr_6, 1, $this->year); $this->cohort_timestamp[12]['baseline_start'] = mktime(0, 0, 0, $this->month - 13 + $this->nr_12, 1, $this->year); $this->cohort_timestamp[12]['baseline_stop'] = mktime(0, 0, 0, $this->month - 12 + $this->nr_12, 1, $this->year); $this->cohort_timestamp[12]['end_cohort_start'] = mktime(0, 0, 0, $this->month - 1 + $this->nr_12, 1, $this->year); $this->cohort_timestamp[12]['end_cohort_stop'] = mktime(0, 0, 0, $this->month + $this->nr_12, 1, $this->year); if ($debug) { foreach ($this->cohort_timestamp[6] as $var) { echo date('Y-m-d', $var) . "<br>"; } } parent::calc_timeframe(); }