config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/engines/funcs/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/engines/funcs/r/date_function.result

DROP TABLE IF EXISTS t3;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DATE(c1) FROM t3;
DATE(c1)
1000-01-01
1999-12-31
2000-01-01
2006-12-25
2008-02-29
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DATE(c1) FROM t3;
DATE(c1)
1000-01-01
1999-12-31
2000-01-01
2006-12-25
2008-02-29
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DATE(c1) FROM t3;
DATE(c1)
0000-00-00
1999-12-31
2000-01-01
2006-12-25
2008-02-29
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYNAME(c1) FROM t3;
DAYNAME(c1)
Wednesday
Friday
Saturday
Monday
Friday
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYNAME(c1) FROM t3;
DAYNAME(c1)
Wednesday
Friday
Saturday
Monday
Friday
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYNAME(c1) FROM t3;
DAYNAME(c1)
NULL
Friday
Saturday
Monday
Friday
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFMONTH(c1) FROM t3;
DAYOFMONTH(c1)
1
31
1
25
29
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFMONTH(c1) FROM t3;
DAYOFMONTH(c1)
1
31
1
25
29
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFMONTH(c1) FROM t3;
DAYOFMONTH(c1)
0
31
1
25
29
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFWEEK(c1) FROM t3;
DAYOFWEEK(c1)
4
6
7
2
6
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFWEEK(c1) FROM t3;
DAYOFWEEK(c1)
4
6
7
2
6
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFWEEK(c1) FROM t3;
DAYOFWEEK(c1)
NULL
6
7
2
6
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFYEAR(c1) FROM t3;
DAYOFYEAR(c1)
1
365
1
359
60
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFYEAR(c1) FROM t3;
DAYOFYEAR(c1)
1
365
1
359
60
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT DAYOFYEAR(c1) FROM t3;
DAYOFYEAR(c1)
NULL
365
1
359
60
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT FROM_DAYS(c1) FROM t3;
FROM_DAYS(c1)
0000-00-00
0000-00-00
0000-00-00
0000-00-00
0000-00-00
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT FROM_DAYS(c1) FROM t3;
FROM_DAYS(c1)
0000-00-00
0000-00-00
0000-00-00
0000-00-00
0000-00-00
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT FROM_DAYS(c1) FROM t3;
FROM_DAYS(c1)
0000-00-00
0000-00-00
0000-00-00
0000-00-00
0000-00-00
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT LAST_DAY(c1) FROM t3;
LAST_DAY(c1)
1000-01-31
1999-12-31
2000-01-31
2006-12-31
2008-02-29
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT LAST_DAY(c1) FROM t3;
LAST_DAY(c1)
1000-01-31
1999-12-31
2000-01-31
2006-12-31
2008-02-29
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT LAST_DAY(c1) FROM t3;
LAST_DAY(c1)
NULL
1999-12-31
2000-01-31
2006-12-31
2008-02-29
Warnings:
Warning	1292	Incorrect datetime value: '0000-00-00'
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTH(c1) FROM t3;
MONTH(c1)
1
12
1
12
2
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTH(c1) FROM t3;
MONTH(c1)
1
12
1
12
2
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTH(c1) FROM t3;
MONTH(c1)
0
12
1
12
2
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTHNAME(c1) FROM t3;
MONTHNAME(c1)
January
December
January
December
February
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTHNAME(c1) FROM t3;
MONTHNAME(c1)
January
December
January
December
February
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT MONTHNAME(c1) FROM t3;
MONTHNAME(c1)
NULL
December
January
December
February
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT QUARTER(c1) FROM t3;
QUARTER(c1)
1
4
1
4
1
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT QUARTER(c1) FROM t3;
QUARTER(c1)
1
4
1
4
1
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT QUARTER(c1) FROM t3;
QUARTER(c1)
0
4
1
4
1
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TIMESTAMP(c1) FROM t3;
TIMESTAMP(c1)
1000-01-01 00:00:00
1999-12-31 00:00:00
2000-01-01 00:00:00
2006-12-25 00:00:00
2008-02-29 00:00:00
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TIMESTAMP(c1) FROM t3;
TIMESTAMP(c1)
1000-01-01 00:00:00
1999-12-31 00:00:00
2000-01-01 00:00:00
2006-12-25 00:00:00
2008-02-29 00:00:00
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TIMESTAMP(c1) FROM t3;
TIMESTAMP(c1)
0000-00-00 00:00:00
1999-12-31 00:00:00
2000-01-01 00:00:00
2006-12-25 00:00:00
2008-02-29 00:00:00
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TO_DAYS(c1) FROM t3;
TO_DAYS(c1)
365243
730484
730485
733035
733466
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TO_DAYS(c1) FROM t3;
TO_DAYS(c1)
365243
730484
730485
733035
733466
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT TO_DAYS(c1) FROM t3;
TO_DAYS(c1)
NULL
730484
730485
733035
733466
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEK(c1) FROM t3;
WEEK(c1)
0
52
0
52
8
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEK(c1) FROM t3;
WEEK(c1)
0
52
0
52
8
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEK(c1) FROM t3;
WEEK(c1)
NULL
52
0
52
8
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKDAY(c1) FROM t3;
WEEKDAY(c1)
2
4
5
0
4
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKDAY(c1) FROM t3;
WEEKDAY(c1)
2
4
5
0
4
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKDAY(c1) FROM t3;
WEEKDAY(c1)
NULL
4
5
0
4
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKOFYEAR(c1) FROM t3;
WEEKOFYEAR(c1)
1
52
52
52
9
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKOFYEAR(c1) FROM t3;
WEEKOFYEAR(c1)
1
52
52
52
9
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT WEEKOFYEAR(c1) FROM t3;
WEEKOFYEAR(c1)
NULL
52
52
52
9
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEAR(c1) FROM t3;
YEAR(c1)
1000
1999
2000
2006
2008
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEAR(c1) FROM t3;
YEAR(c1)
1000
1999
2000
2006
2008
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEAR(c1) FROM t3;
YEAR(c1)
0
1999
2000
2006
2008
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEARWEEK(c1) FROM t3;
YEARWEEK(c1)
99952
199952
199952
200652
200808
DROP TABLE t3;
CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEARWEEK(c1) FROM t3;
YEARWEEK(c1)
99952
199952
199952
200652
200808
DROP TABLE t3;
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
Warnings:
Warning	1264	Out of range value for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
SELECT YEARWEEK(c1) FROM t3;
YEARWEEK(c1)
NULL
199952
199952
200652
200808
DROP TABLE t3;
SET sql_mode=default;

Man Man