defaults, $field);
if(preg_match('/^dd?\//', $field['date_format'])) { // if start with dd/ or d/ (not supported by strtotime())
$value = str_replace('/', '-', $value);
}
$value = date('Y-m-d H:i:s', strtotime($value));
return $value;
}
/**
* Format date and time after it is loaded from the db
*
* @since 1.0.0
*
* @param mixed $value The value found in the database
* @param mixed $post_id The post ID from which the value was loaded
* @param array $field The field array holding all the field options
*
* @return mixed The formatted date and time
*/
public function load_value($value, $post_id, $field) {
$field = array_merge($this->defaults, $field);
return $this->dtp->format_date_time($value, $field);
}
}
// initialize field class
new acf_field_date_time_picker();
endif;