Date Format by input |
10-23-2017, 01:10 PM
(This post was last modified: 10-23-2017, 01:15 PM by PaulD. Edit Reason: Added PS ) (10-23-2017, 12:28 PM)Marcolino92 Wrote: Hi, I'm using the "date" fields of a form, so of course the date will be this way: 2017-10-05 Not sure how you get from 2017-10-5 to May 24 but assuming this is just an example..... Convert the incoming date to a MySQL date format and store in the database. When reading the date out to a page, just format it how you want with php date functions: http://php.net/manual/en/function.date.php In your case something like: PHP Code: <?php However, better to use the ordinal S PHP Code: echo date('M jS, Y', strtotime($mysql_date)); Hope that helps, Paul. PS If you really want to store the formatted date in your database as you actually asked then just use the date functions to convert it and then store it in a varchar field. PHP Code: $date = '2017-10-05'; |
Messages In This Thread |
Date Format by input - by Marcolino92 - 10-23-2017, 12:28 PM
RE: Date Format by input - by PaulD - 10-23-2017, 01:10 PM
RE: Date Format by input - by neuron - 10-23-2017, 11:25 PM
RE: Date Format by input - by Marcolino92 - 10-26-2017, 10:38 PM
|