Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format date

Status
Not open for further replies.

litton1

Technical User
Apr 21, 2005
584
GB
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

Age is a consequence of experience
 
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.
 
As always thx. I will continue with the date, just thought they may be another way thx again 4 the advice.

Age is a consequence of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top