Prob with date formate in mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GaneshPrasad
Forum Newbie
Posts: 5
Joined: Thu Mar 22, 2012 12:50 am

Prob with date formate in mysql

Post by GaneshPrasad »

Hi sir good afternoon,
In the mysql default date formate is ("yy/mm/dd") but I want to insert date formate like ("dd/mm/yy") if there is any alternative pls help me
Even I tried using str_to_date() function but it is displaying mysql default formate.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Prob with date formate in mysql

Post by Celauran »

Default format for DATETIME is YYYY-MM-DD. What is the column type in your table?
eoin.ahern@mycit.ie
Forum Newbie
Posts: 15
Joined: Mon Mar 05, 2012 11:48 am

Re: Prob with date formate in mysql

Post by eoin.ahern@mycit.ie »

yes i had to create a date time column in a table yesterday and this worked for me as Celauran stated above default format for datetime is YYYY-MM-DD. so
i used $datetime =date('Y-m-d H:i:s');
eoin.ahern@mycit.ie
Forum Newbie
Posts: 15
Joined: Mon Mar 05, 2012 11:48 am

Re: Prob with date formate in mysql

Post by eoin.ahern@mycit.ie »

or you could try date('d/m/y H:i:s'); not sure if that would work though.
eoin.ahern@mycit.ie
Forum Newbie
Posts: 15
Joined: Mon Mar 05, 2012 11:48 am

Re: Prob with date formate in mysql

Post by eoin.ahern@mycit.ie »

but it probably will! :)
GaneshPrasad
Forum Newbie
Posts: 5
Joined: Thu Mar 22, 2012 12:50 am

Re: Prob with date formate in mysql

Post by GaneshPrasad »

column datatype is Date
Post Reply