Hi guys having some trouble here with my date's output currently it reads 2015-05-05 10:05:22 but i would like to have it render as eg. Monday 12 Mei 2013 how would i achieve this in codeigniter?
Here is my code for creating the post: (Controller)
public function new_post(){
if($_POST){
$data = array(
'title' => $_POST['post_title'] ,
'post' => $_POST['post_entry'],
'slug' => $_POST['seo_slug'],
'active' => 1
);
$this->db->insert_post($data);
redirect(base_url() .'home');
} else {
$data['main_content'] = 'blog/new_post';
$this->load->view('templates/2015/template',$data);
}
}
And then the model:
public function insert_post($data){
$this->db->insert('blog',$data);
return $this->db->insert_id();
}
and the view:
<div class="panel panel-default" id="blog-roll">
<div class="panel-body">
<div id="blog">
<div id="blog_post">
<?php if(count($posts) == 0) { ?>
<p>There are currently no posts on my blog, please check back later!</p>
<?php } else {
foreach ($posts as $post) {
?>
<h2><a href="<?=base_url()?>blogs/post/<?=$post['slug']?>"><?=$post['title']?></a></h2>
<p><?=substr(strip_tags($post['post']),0,300)."."?></p>
<p id="info-box"><i>
Posted by: <i class="fa fa-user"></i> Riaan Venter
on <i class="fa fa-calendar"> </i>: <?=$post['date_added']?>
</i></p>
<hr>
<?php
}
}
?>
</div>
</div> <!-- blog roll -->
</div>
</div>
Some help would really be appreciated.