Need help in retrive date format with am/pm in codeignitor

Posted by JigneshMistry on Stack Overflow See other posts from Stack Overflow or by JigneshMistry
Published on 2012-04-11T11:27:14Z Indexed on 2012/04/11 11:28 UTC
Read the original article Hit count: 214

Filed under:

I have got one problem. which is as follow I have converted date to my local time as below

$this->date_string = "%Y/%m/%d %h:%i:%s";
  $timestamp = now();
  $timezone = 'UP45';
  $daylight_saving = TRUE;
  $time =  gmt_to_local($timestamp, $timezone, $daylight_saving);
$this->updated_date = mdate($this->date_string,$time); 

And Storing this field in to database.

now at retrive time i want like this format

"11-04-2011 4:50:00 PM" 

I have used this code

$timestamp = strtotime($rs->updated_date);
$date1 = "%d-%m-%Y %h:%i:%s %a";
$updat1 = date($date1,$timestamp); 

but this will give me only

"11-04-2011 4:50:00 AM" 

but I have stored in like it was PM. Can any one help me out. thanks.

© Stack Overflow or respective owner

Related posts about codeigniter