[eluser]digitalbloke[/eluser]
Thanks for the reply tkyy.
Sorry, I don't think I made it very clear what I was after. I understand about the PHP date functions, I'm just wondering where is the best place to put them. See the lines commented 'convert date' in the two examples below. Which would you use?
N.B. Obviously this is a very simple version of the code (there may even be errors!)
Example 1:
Controller:
Code:
class News extends Controller
{
function create()
{
$news['title'] = $this->input->post('title');
$news['date'] = $this->input->post('date');
// convert date
$news['date'] = human_to_unix($news['date']);
$this->news_model->create($news);
}
}
Model:
Code:
class News_model extends Model
{
function create($data)
{
$this->db->insert('news', $data);
}
}
-------------------
Example 2:
Controller:
Code:
class News extends Controller
{
function create()
{
$news['title'] = $this->input->post('title');
$news['date'] = $this->input->post('date');
$this->news_model->create($news);
}
}
Model:
Code:
class News_model extends Model
{
function create($data)
{
// convert date
$data['date'] = human_to_unix($date['date']);
$this->db->insert('news', $data);
}
}
Thanks in advance!