summaryrefslogtreecommitdiff
path: root/mysql-test/r/date_formats.result
blob: e21e05b4dfe9b88a1b67671c6e6fa74847a14b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name	Value
date_format	%d.%m.%Y
datetime_format	%Y/%d/%m-%H:%i:%s
default_week_format	0
time_format	%H.%i.%s
SHOW SESSION VARIABLES LIKE "%_format%";
Variable_name	Value
date_format	%d.%m.%Y
datetime_format	%Y/%d/%m-%H:%i:%s
default_week_format	0
time_format	%H.%i.%s
SET date_format="%d.%m.%Y";
select CAST("01.01.2001" as DATE) as a;
a
01.01.2001
SET datetime_format="%d.%m.%Y %H.%i.%s";
select CAST("01.01.2001 05.12.06" as DATETIME) as a;
a
01.01.2001 05.12.06
SET time_format="%H.%i.%s";
select CAST("05.12.06" as TIME) as a;
a
05.12.06
SET datetime_format="%d.%m.%Y %h:%i:%s %p";
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a;
a
01.01.2001 05:12:06 AM
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a;
a
01.01.2001 05:12:06 PM
SET time_format="%h:%i:%s %p";
select CAST("05:12:06 AM" as TIME) as a;
a
05:12:06 AM
select CAST("05:12:06.1234PM" as TIME) as a;
a
05:12:06.001234 PM
SET time_format="%h.%i.%s %p";
SET date_format='%d.%m.%y';
SET datetime_format="%d.%m.%y %h.%i.%s %p";
select CAST("12-12-06" as DATE) as a;
a
12.12.06
select adddate("01.01.97 11.59.59.000001 PM", 10);
adddate("01.01.97 11.59.59.000001 PM", 10)
11.01.97 11.59.59.000001 PM
select datediff("31.12.97 11.59:59.000001 PM","01.01.98");
datediff("31.12.97 11.59:59.000001 PM","01.01.98")
-1
select weekofyear("31.11.97 11:59:59.000001 PM");
weekofyear("31.11.97 11:59:59.000001 PM")
49
select makedate(1997,1);
makedate(1997,1)
01.01.97
select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002");
addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")
02.01.98 01.01.01.000001 AM
select maketime(23,11,12);
maketime(23,11,12)
11.11.12 PM
select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM");
timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")
8795.59.59.999999 PM
SET time_format="%H%i%s";
SET time_format="%h%i%s";
ERROR HY000: Unknown error
SET date_format='%d.%m.%d';
ERROR HY000: Unknown error
SET datetime_format="%d.%m.%y %h.%i.%s";
ERROR HY000: Unknown error
SET GLOBAL date_format=default;
SHOW GLOBAL VARIABLES LIKE "date_format%";
Variable_name	Value
date_format	%d.%m.%Y
SET GLOBAL time_format=default;
SHOW GLOBAL VARIABLES LIKE "time_format%";
Variable_name	Value
time_format	%H.%i.%s
SET GLOBAL datetime_format=default;
SHOW GLOBAL VARIABLES LIKE "datetime_format%";
Variable_name	Value
datetime_format	%Y/%d/%m-%H:%i:%s
SET date_format=default;
SHOW SESSION VARIABLES LIKE "date_format%";
Variable_name	Value
date_format	%d.%m.%Y
SET time_format=default;
SHOW SESSION VARIABLES LIKE "time_format%";
Variable_name	Value
time_format	%H.%i.%s
SET datetime_format=default;
SHOW SESSION VARIABLES LIKE "datetime_format%";
Variable_name	Value
datetime_format	%Y/%d/%m-%H:%i:%s
SET time_format='%i:%s:%H';
select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME);
cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)
59:59:12
SET GLOBAL date_format='%Y-%m-%d';
SET GLOBAL time_format='%H:%i:%s';
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s';
SET date_format='%Y-%m-%d';
SET time_format='%H:%i:%s';
SET datetime_format='%Y-%m-%d %H:%i:%s';
select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S");
str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S")
2001-01-15 12:59:59
select str_to_date("15 September 2001", "%d %M %Y");
str_to_date("15 September 2001", "%d %M %Y")
2001-09-15 00:00:00
select str_to_date("15 Septembeb 2001", "%d %M %Y");
str_to_date("15 Septembeb 2001", "%d %M %Y")
NULL
select str_to_date("15 MAY 2001", "%d %b %Y");
str_to_date("15 MAY 2001", "%d %b %Y")
2001-05-15 00:00:00
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y");
str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y")
2001-05-15 00:00:00
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y");
str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y")
NULL
select str_to_date("Sundai 15 MA", "%W %d %b %Y");
str_to_date("Sundai 15 MA", "%W %d %b %Y")
NULL
select str_to_date("Tuesday 52 2001", "%W %V %X");
str_to_date("Tuesday 52 2001", "%W %V %X")
NULL
select str_to_date("Sunday 01 2001", "%W %V %X");
str_to_date("Sunday 01 2001", "%W %V %X")
NULL
select str_to_date("Tuesday 00 2002", "%W %U %Y");
str_to_date("Tuesday 00 2002", "%W %U %Y")
2002-01-01 00:00:00
select str_to_date("Thursday 53 1998", "%W %u %Y");
str_to_date("Thursday 53 1998", "%W %u %Y")
1998-12-31 00:00:00
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S");
str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S")
2001-01-15 00:00:00
select str_to_date("15-01-20", "%d-%m-%Y");
str_to_date("15-01-20", "%d-%m-%Y")
NULL
select str_to_date("15-2001-1", "%d-%Y-%c");
str_to_date("15-2001-1", "%d-%Y-%c")
2001-01-15 00:00:00
select get_format(DATE, 'USA') as a;
a
%m.%d.%Y
select get_format(TIME, 'internal') as a;
a
%H%i%s
select get_format(DATETIME, 'eur') as a;
a
%Y-%m-%d-%H.%i.%s
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
Warnings:
Note	1003	select high_priority makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`