How can Codeigniter's ActiveRecord functions be utilized effectively for working with date and time data in MySQL?

When working with date and time data in MySQL using Codeigniter's ActiveRecord functions, it is important to properly format the date and time values to ensure accurate querying and manipulation. One way to achieve this is by using Codeigniter's date helper functions to format the date and time values before inserting or querying the database.

// Example of inserting a record with a formatted date using Codeigniter's date helper functions
$data = array(
    'event_date' => date('Y-m-d', strtotime($event_date)),
    'event_time' => date('H:i:s', strtotime($event_time))
);

$this->db->insert('events', $data);