Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies


Why is converting date formats so difficult with php and mysql?



1:20 pm on Jun 26, 2011 (gmt 0)

10+ Year Member

Someone please tell me how to make this work?

$result = mysql_query("SELECT * FROM kabf_blog ORDER BY id DESC LIMIT 10 DATE_FORMAT(datetime,%e.%c.%y)");

The field is titled 'datetime' and what's going into the field is:

$datetime = date ("Y-m-d H:m:s");

I just want to format the date so that June 26, 2011 reads like: 6.26.11

Is that so much to ask?

Why are dates so difficult to manipulate in PHP and SQL?

Anyone with the expertise to help get me though this, I truly appreciate you..!


1:21 pm on Jun 26, 2011 (gmt 0)

10+ Year Member

I'm sure this is simple stuff for some of you - and I bet the topic has been covered to death - I just can't make sense of it no matter how much searching and reading I do...


4:22 pm on Jun 26, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Why would you want to introduce ambiguity into what you print?

Why would you want to add the "centuries problem" into what you print?

A European citizen, working for a US company in Japan tells you the order must be completed by "12.10.11". Do you have 3.5 months, 5.5 months or 15.5 months to complete this task?

2011-06-26 as YYYY-MM-DD is the ONLY date format that is understood in every country of the world.

They baked that into ANSI X3.30 in the late 1960s, ISO 8601 and EN 28601 in the mid-1980s and RFC 3339 in the early 2000s.


5:26 pm on Jun 26, 2011 (gmt 0)

10+ Year Member

Alright, well it's for a local website and it's for aesthetic reasons... do you have any information that would be helpful for me?


5:26 pm on Jun 26, 2011 (gmt 0)

10+ Year Member

I was just reading about ISO date standards yesterday so I am familiar with your point.

Featured Threads

Hot Threads This Week

Hot Threads This Month