my input text box let user insert date
but when i insert it to db..
the data come with 2014-12-22 (year-month-day)
i want d,m,Y format.. how to ? thanks
my input text box let user insert date
but when i insert it to db..
the data come with 2014-12-22 (year-month-day)
i want d,m,Y format.. how to ? thanks
mysql only stores in yyyy-mm-dd. I want day - month - year too; its how I read dates. You'll need to store how MySQL wants, though.
Fortunately, you can use DATE_FORMAT( ) to format the date so your query returns it in d-m-Y (assuming you have the correct field type).
SELECT DATE_FORMAT(date_field, '%d-%m-%Y') AS dmy FROM your_table
but if user input '12-09-2006' then in mysql it will '2012-09-20'
is allright with that? the year 2012, and so the day 20 ??
This is why it's a bad idea to use text entry for inputting dates. You really have no idea what format the user is following. What is "05-06-07", or "01-02-2006"? Use, e.g., drop-down selects for month, day, and year. Then you know exactly what is intended, with the bonus that you can then easily assemble the date parts into a db-compatible format, and/or your own preferred format for display, date artithmetic, php function use, etc.
yeah, installer, that's the way it is...
thanks...this thread resolved.