DATETIME, DATE TIMESTAMP MySQL
» PHP » MySQL » DATETIME, DATE TIMESTAMP MySQL
DATETIME, DATE TIMESTAMP . .
DATETIME , , . MySQL DATETIME YYYY-MM-DD HH:MM:SS. : 1000-01-01 00:00:00 9999-12-31 23:59:59.
DATE , , . MySQL DATE YYYY-MM-DD. : 1000-01-01 9999-12-31.
TIMESTAMP , , INSERT UPDATE . TIMESTAMP. , , . TIMESTAMP, .
TIMESTAMP :
- INSERT LOAD DATA INFILE;
- UPDATE . , UPDATE, , , TIMESTAMP, , , MySQL ;
- TIMESTAMP NULL.
TIMESTAMP . NULL NOW().
TIMESTAMP , , . TIMESTAMP. , , , , TIMESTAMP , , , :
- MySQL , . ;
- , TIMESTAMP .
TIMESTAMP . .
, MySQL TIMESTAMP, , . 5.2. TIMESTAMP 14 , :
5.2. TIMESTAMP.
TIMESTAMP (14) | YYYYMMDDHHMMSS |
TIMESTAMP (12) | YYMMDDHHMMSS |
TIMESTAMP (10) | YYMMDDHHMM |
TIMESTAMP (8) | YYYYMMDD |
TIMESTAMP (6) | YYMMDD |
TIMESTAMP (4) | YYMM |
TIMESTAMP (2) | YY |
TIMESTAMP , . , , .
: 6, 8, 12 14. , , 0 14, 14. 1 13 .
DATETIME, DATE TIMESTAMP, :
- YYYY-MM-DD HH:MM:SS YY-MM-DD HH:MM:SS. : . , 98-12-31 11:30:45, 98.12.31 11+30+45, 98/12/31 11*30*45 98@12@31 11305 ;
- YYYY-MM-DD YY-MM-DD. : , 98-12-31, 98.12.31, 98/12/31 98@12@31 ;
- YYYYMMDDHHMMSS YYMMDDHHMMSS, , . , 19970523091528 970523091528 1997-05-23 09:15:28, 971122129015 ( ) 0000-00-00 00:00:00;
- YYYYMMDD YYMMDD, , . , 19970523 970523
- 1997-05-23, 971332 ( ) 0000-00-00;
- YYYYMMDDHHMMSS YYMMDDHHMMSS, , . , 19830905132800 830905132800 1983-09-05 13:28:00;
- YYYYMMDD YYMMDD , . , 19830905 830905 1983-09-05;
- , , DATETIME, DATE TIMESTAMP, NOW(), CURRENT_DATE.
DATETIME, DATE TIMESTAMP (0000-00-00 00:00:00, 0000-00-00 00000000000000 ).
, , , , , 10: 1979-6-9, 1979-06-09. , , , , , , 10: 1979-10-30 1:2:3 , 1979-10-30 01:02:03.
, , , 8,12 14 . 8 14 , , YYYYMMDD YYYYMMDDHHMMSS, 4 . 12 , , YYMMDD YYMMDDHHMMSS, 2 . , , .
, , , . , . , 9903, , 1999 , , MySQL . , 99 03, , . --.
TIMESTAMP , , , . :
- , , TIMESTAMP(4) TIMESTAMP(2). , , 0;
- ALTER TABLE ( ), TIMESTAMP, , . ( ), - !
- TIMESTAMP , , . ;
- TIMESTAMP , UNIX_TIMESTAMP() . . HOUR() SECOND(), TIMESTAMP ( , , ). , TIMESTAMP , 10. , .
. , :
- DATE DATETIME TIMESTAMP, , 00:00:00 , DATE ;
- DATE DATETIME TIMESTAMP, , DATE ;
- , , DATETIME, DATE TIMESTAMP , . , . TIMESTAMP , 1970, , 2037. , 1968-01-01, DATETIME DATE, TIMESTAMP 0. , !
:
- , , , , , . , 10:11:12 - , , 2010-11-12. 10:45:15 0000-00-00 , 45 ;
- , , , . MySQL , .