Welcome Guest, Not a member yet? Register   Sign In
MYSQl DATETIME string Format
#1

[eluser]Yash[/eluser]
Code:
date("l, F jS, Y n:i A",strtotime($posts['PostedDate']));
This gives
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
#2

[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)
#3

[eluser]Yash[/eluser]
ok I added at but S still giving rd Sad
#4

[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 Wink If you want it to always be "th" you need to do the same thing you did with "at" and escape it. Stick with the S though.
#5

[eluser]Yash[/eluser]
I already got that...

anyways thank you for making things crystal clear.




Theme © iAndrew 2016 - Forum software by © MyBB