MySQL is configured so that it accepts date values ​​only in the хххх-хх-хх format, please tell me how to set it up so that MySQL itself converts the date to the desired format (for example, we insert a 0000-00-00 value into it, but it interprets it as 0000-00-00 and so on). PS: version 5.5.

    1 answer 1

    MySQL stores the date only in a convenient format - YYYY-MM-DD. All manipulations with date / time when using MySQL DBMS are performed on the client side (PHP, C ++, Delphi, ...), by string transformations.

    A source

    DATE

    A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL displays DATE values ​​in YYYY-MM-DD format

    DATETIME

    A date and time combination. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. MySQL displays HY: MM: SSYYY-MM-DD values:

    • Maybe I did not understand, please look at the link: Problems with the use of DATE columns . The documentation says that mysql transforms everything as it should, and I have denwer, in it mysql works as written by reference. - thedarkelf
    • It says soft check is used. You can use other punctuation marks in hyphens. But to rearrange the year, month and day - it is impossible. And if you insert NULL in the field with the date, and this field allows empty values, then it should also be displayed when sampling NULL. [For example] [1]. [1]: shot.photo.qip.ru/004ki2-202M2Ft - KiTE
    • Probably, I have a poorly formulated question)) So I just need a "soft check." - thedarkelf Nov.
    • Then, go ahead. :) Only SELECTs will still return YYYY-MM-DD. - KiTE
    • where to go)) the problem is that there is no such “soft check”, so I’m trying to find out how to turn it on) - thedarkelf