Does anyone know if it is possible to format a date column when creating a table, cannot seem to find anything on this only on formatting when retrieving the data? thx
MySQL has a native DATE type, which must be specified in the form "yyyy-mm-dd" (or yyyymmdd); that is the most efficient way to store a date, and MySQL provides lots of functions for processing that type of date. If you're thinking of storing dates as formatted strings, then think again; it will make queries far more complicated and inefficient. You'd be much better off sticking to the standard data types.
and since many people want to display the data differently, that is why date_format exists so you have numerous options to choose from when pulling your dates. If you use varchar or char to store your dates then you lose all date calculation functionality.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.