![]() |
MYSQl DATETIME string Format - 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: MYSQl DATETIME string Format (/showthread.php?tid=9471) |
MYSQl DATETIME string Format - El Forum - 06-26-2008 [eluser]Yash[/eluser] Code: date("l, F jS, Y n:i A",strtotime($posts['PostedDate'])); Monday, February 3rd, 2003 2:11 PM Now I want Monday, February 3th, 2003 at 2:11 PM I mean want to add "at" in between and rd to be replaced with th MYSQl DATETIME string Format - El Forum - 06-26-2008 [eluser]xwero[/eluser] the S you added should take care of the th like you can see on the php.net date function page. The at you can add by escaping the word with a backslash, but because the t is a character that is in the date formating you need to double backslash it. (see the second example on the same php.net page) MYSQl DATETIME string Format - El Forum - 06-26-2008 [eluser]Yash[/eluser] ok I added at but S still giving rd ![]() MYSQl DATETIME string Format - El Forum - 06-26-2008 [eluser]parrots[/eluser] S will give you suffix based on the number, 1 => st, 2 => nd, 3 => rd, 4+ => th. So it isn't giving you "th" because "3th" isn't correct ![]() MYSQl DATETIME string Format - El Forum - 06-26-2008 [eluser]Yash[/eluser] I already got that... anyways thank you for making things crystal clear. |