|
I don't know about MySQL formatting, but I can tell you how this works in SQL Server, and assume that it's fairly similar.
The date isn't actually stored in any particular format. It's stored as a series of byte values. I think it's about 1.5 bytes for the month and day, and 2.5 for the year, or 4 in all. (We have small and full date time types.) How you express these (MM-DD-YYYY or DD-MM-YYYY or YYYY-DD-MM or MM-DD-YY) actually isn't connected to how they're stored on disc. And for that reason, we're actually able to input them (using insert commands) in any particular format, so long as the server can tell what's what.
To get them formatted a particular way, our choices are limited. There are a few pre set ones that we can use the Convert function to get. Or we can use DatePart functions to extract the month, day, and year, then use string concatenation to put them back together. But for the most part, it doens't matter how they're formatted where SQL runs. Formatting is a function of consuming data, not processing it. So our ASP.NET code might query the database and fetch a list of values, including a date, and then format it in such and such a way while writing HTML all around it.
|