/** * Specify an end date that limits what you care about for the publication * * @param string mysql_datetime format * @param normalize time to end of the day (11:59 PM) - default true */ function set_end_date($end_date, $normalize = true) { if (is_mysql_datetime($end_date) || preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $end_date)) { if ($normalize) { $end_date = carl_date('Y-m-d 11:59:59', get_unix_timestamp($end_date)); } $this->end_date = $end_date; $this->date_changed = true; } else { trigger_error('publication helper method set_end_date given a value that is not in mysql_datetime format - did not set the end date'); } }
function datetime_to_unix($dt, $verify = true) { if ($verify && !is_mysql_datetime($dt)) { return false; } else { list($date, $time) = explode(' ', $dt); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); return carl_mktime($hour, $minute, $second, $month, $day, $year); } }