Need help in getting date time with am pm - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Need help in getting date time with am pm (/showthread.php?tid=50854) |
Need help in getting date time with am pm - El Forum - 04-11-2012 [eluser]Mistry007[/eluser] Hi every one. I have got one problem. which is as follow I have converted date to my local time as below Code: $this->date_string = "%Y/%m/%d %h:%i:%s"; And Storing this field in to database. now at retrive time i want like this format Code: "11-04-2011 4:50:00 PM" Code: $timestamp = strtotime($rs->updated_date); Code: "11-04-2011 4:50:00 AM" Can any one help me out. thanks. Need help in getting date time with am pm - El Forum - 04-11-2012 [eluser]zoopstud[/eluser] Code: $this->date_string = "%Y/%m/%d %h:%i:%s"; Your missed the %a, also if you want AM PM it needs to be a capital A Code: $this->date_string = "%Y/%m/%d %h:%i:%s %A"; Think the default is am. Need help in getting date time with am pm - El Forum - 04-11-2012 [eluser]Mistry007[/eluser] Hi thanks for help. Actually i have missed something else to. that is Code: $this->date_string = "%Y/%m/%d %h:%i:%s"; In this code i have converted the format string in 12 hours format. that was my mistake. now i have sloved this. Code: $this->date_string = "%Y/%m/%d %H:%i:%s"; Now using this I have sloved this problem. thanks for this help. I have used "%A" now and its working fine now. Thanks a lot. |