1
SELECT DAYOFMONTH(NULL);
5
ERROR 42000: Incorrect parameter count in the call to native function 'DAYOFMONTH'
6
SELECT DAYOFMONTH(1, 0);
7
ERROR 42000: Incorrect parameter count in the call to native function 'DAYOFMONTH'
8
SELECT DAYOFMONTH("xxx");
9
ERROR HY000: Received an invalid datetime value 'xxx'.
10
SELECT DAYOFMONTH("0000-00-00");
11
ERROR HY000: Received an invalid datetime value '0000-00-00'.
12
SELECT DAYOFMONTH("0000-01-01");
13
ERROR HY000: Received an invalid datetime value '0000-01-01'.
14
SELECT DAYOFMONTH("0001-00-01");
15
ERROR HY000: Received an invalid datetime value '0001-00-01'.
16
SELECT DAYOFMONTH("0001-01-00");
17
ERROR HY000: Received an invalid datetime value '0001-01-00'.
18
SELECT DAYOFMONTH("2000-02-30");
19
ERROR HY000: Received an invalid datetime value '2000-02-30'.
20
SELECT DAYOFMONTH("1900-02-29");
21
ERROR HY000: Received an invalid datetime value '1900-02-29'.
22
SELECT DAYOFMONTH('1976-15-15');
23
ERROR HY000: Received an invalid datetime value '1976-15-15'.
24
SELECT DAYOFMONTH("2009-01-12");
25
DAYOFMONTH("2009-01-12")
27
SELECT DAYOFMONTH("70-12-31");
28
DAYOFMONTH("70-12-31")
30
SELECT DAYOFMONTH("00-02-29");
31
DAYOFMONTH("00-02-29")
33
SELECT DAYOFMONTH("0001-12-31");
34
DAYOFMONTH("0001-12-31")
36
SELECT DAYOFMONTH('07/31/2009');
37
DAYOFMONTH('07/31/2009')
39
SELECT DAYOFMONTH('20090916');
40
DAYOFMONTH('20090916')
42
SELECT DAYOFMONTH('20090916091528');
43
DAYOFMONTH('20090916091528')
45
SELECT DAYOFMONTH("20090916091528.000000");
46
DAYOFMONTH("20090916091528.000000")
48
SELECT DAYOFMONTH('09-09-16');
49
DAYOFMONTH('09-09-16')
51
SELECT DAYOFMONTH('09.09.16');
52
DAYOFMONTH('09.09.16')
54
SELECT DAYOFMONTH('09/09/16');
55
DAYOFMONTH('09/09/16')
57
SELECT DAYOFMONTH('09-09-16');
58
DAYOFMONTH('09-09-16')
60
SELECT DAYOFMONTH('09-9-2');
63
SELECT DAYOFMONTH(20090916);
66
SELECT DAYOFMONTH(20090916091528);
67
DAYOFMONTH(20090916091528)
69
SELECT DAYOFMONTH(20090916091528.000000);
70
ERROR HY000: Received an invalid datetime value '20090916091528.000000'.
72
DROP TABLE IF EXISTS t1;
75
, date_fld DATE NOT NULL
76
, datetime_fld DATETIME NOT NULL
77
, timestamp_fld TIMESTAMP NOT NULL
78
, char_fld CHAR(22) NOT NULL
79
, varchar_fld VARCHAR(22) NOT NULL
80
, text_fld TEXT NOT NULL
81
, blob_fld BLOB NOT NULL
83
INSERT INTO t1 VALUES (
86
, "2007-11-30 16:30:19"
87
, "2007-11-30T16:30:19"
88
, "2007-11-30 16:30:19"
89
, "2007-11-30 16:30:19"
90
, "2007-11-30T16:30:19"
91
, "2007-11-30T16:30:19"
93
SELECT DAYOFMONTH(int_fld) FROM t1;
96
SELECT DAYOFMONTH(date_fld) FROM t1;
99
SELECT DAYOFMONTH(datetime_fld) FROM t1;
100
DAYOFMONTH(datetime_fld)
102
SELECT DAYOFMONTH(timestamp_fld) FROM t1;
103
DAYOFMONTH(timestamp_fld)
105
SELECT DAYOFMONTH(char_fld) FROM t1;
108
SELECT DAYOFMONTH(varchar_fld) FROM t1;
109
DAYOFMONTH(varchar_fld)
111
SELECT DAYOFMONTH(text_fld) FROM t1;
114
SELECT DAYOFMONTH(blob_fld) FROM t1;