Hi. Is there any way to insert a date into MySQL that is in standard format? I.e. MM-DD-YYYY? I don't understand why MySQL forces you to put it in backwards YYYY-MM-DD. I would rather just put it in the right way and not have to write a function to reverse it when i pull it back out.
Thanks!😃
Nope it must be YYYY-MM-DD
Ok thanks.
Arc,
You can sort if its YYYY-MM-DD but not if MM-DD-YYYY
and you don't need to write a function to re-format the date the way you want to display it by using DATE_FORMAT in your select query.
do a search for date_format here, it lists all the formatting options http://www.mysql.com/doc/en/Date_and_time_functions.html
OK cool thanks alot.🙂
Why not set a field in the db as a text field and write the date as text. Much easier.
$thedate = date("F d, Y"); print $thedate;
You then lose he ability to apply date/time functions and it won't sort in date order
True, but I didn't see anything in the original post question about having to sort it in any way.