Welcome Guest, Not a member yet? Register   Sign In
Date format in mysql
#1

[eluser]shankar ganesh[/eluser]
Hi All.

Please let me know how to format the date in mysql, the output should be like as below things,

2nd Jan, 2012
9th Nov, 2011
3rd Dec, 2011
23rd Jun 2011
20th Jul 2011

Thanks in advance.
#2

[eluser]InsiteFX[/eluser]
PHP Date Manual
#3

[eluser]shankar ganesh[/eluser]
Hi Research,

It should be done only in mysql query and not by PHP code.
#4

[eluser]shankar ganesh[/eluser]
Hi All,

I got the result by using the below thing,

DATE_FORMAT(car.manuf_date,'%D %b, %Y')

Thanks.
#5

[eluser]vbsaltydog[/eluser]
What does this have to do with CodeIgniter? Please post these types of questions on the appropriate websites so we can help those with CI specific questions.

http://forums.mysql.com/

#6

[eluser]porquero[/eluser]
Here, full description how to use Mysql DATE_FORMAT:

http://dev.mysql.com/doc/refman/5.5/en/d...ate-format

DATE_FORMAT(date,format);
Code:
mysql> SELECT DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y');
        -> 'Sunday October 2009'
mysql> SELECT DATE_FORMAT('2007-10-04 22:23:00', '%H:%i:%s');
        -> '22:23:00'
mysql> SELECT DATE_FORMAT('1900-10-04 22:23:00',
    ->                 '%D %y %a %d %m %b %j');
        -> '4th 00 Thu 04 10 Oct 277'
mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',
    ->                 '%H %k %I %r %T %S %w');
        -> '22 22 10 10:23:00 PM 22:23:00 00 6'
mysql> SELECT DATE_FORMAT('1999-01-01', '%X %V');
        -> '1998 52'
mysql> SELECT DATE_FORMAT('2006-06-00', '%d');
        -> '00'
#7

[eluser]Bhashkar Yadav[/eluser]
i looked at few threads, people post without doing any effort. OR it may be they know all and posting thread just for fun.




Theme © iAndrew 2016 - Forum software by © MyBB