6
6
drop table if exists t1;
9
--replace_result ROW <format> STATEMENT <format> MIXED <format>
10
SHOW GLOBAL VARIABLES LIKE "%e_format";
11
--replace_result ROW <format> STATEMENT <format> MIXED <format>
12
SHOW SESSION VARIABLES LIKE "%e_format";
15
# Test setting a lot of different formats to see which formats are accepted and
19
SET time_format='%H%i%s';
20
SET time_format='%H:%i:%s.%f';
21
SET time_format='%h-%i-%s.%f%p';
22
SET time_format='%h:%i:%s.%f %p';
23
SET time_format='%h:%i:%s%p';
25
SET date_format='%Y%m%d';
26
SET date_format='%Y.%m.%d';
27
SET date_format='%d.%m.%Y';
28
SET date_format='%m-%d-%Y';
30
set datetime_format= '%Y%m%d%H%i%s';
31
set datetime_format= '%Y-%m-%d %H:%i:%s';
32
set datetime_format= '%m-%d-%y %H:%i:%s.%f';
33
set datetime_format= '%d-%m-%Y %h:%i:%s%p';
34
set datetime_format= '%H:%i:%s %Y-%m-%d';
35
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
36
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
37
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
39
--replace_result ROW <format> STATEMENT <format> MIXED <format>
40
SHOW SESSION VARIABLES LIKE "%e_format";
43
SET time_format='%h:%i:%s';
45
SET time_format='%H %i:%s';
47
SET time_format='%H::%i:%s';
49
SET time_format='%H:%i:%s%f';
51
SET time_format='%H:%i.%f:%s';
53
SET time_format='%H:%i:%s%p';
55
SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
57
SET time_format='%H%i%s.%f';
59
SET time_format='%H:%i-%s.%f';
61
SET date_format='%d.%m.%d';
63
SET datetime_format='%h.%m.%y %d.%i.%s';
65
set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
70
set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
71
SET SESSION datetime_format=default;
72
select @@global.datetime_format, @@session.datetime_format;
73
SET GLOBAL datetime_format=default;
74
SET SESSION datetime_format=default;
75
select @@global.datetime_format, @@session.datetime_format;
77
SET GLOBAL date_format=default;
78
SET GLOBAL time_format=default;
79
SET GLOBAL datetime_format=default;
80
SET time_format=default;
81
SET date_format=default;
82
SET datetime_format=default;
85
10
# The following tests will work only when we at some point will enable
86
11
# dynamic changing of formats
117
42
# SET time_format='%i:%s:%H';
118
43
# select cast(str_to_date('15-01-2001 12:59:59', '%d-%m-%Y %H:%i:%S') as TIME);
124
select get_format(DATE, 'USA') as a;
125
select get_format(DATETIME, 'eur') as a;
126
select get_format(TIMESTAMP, 'eur') as a;
127
select get_format(DATE, 'TEST') as a;
129
explain extended select makedate(1997,1), subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),microsecond("1997-12-31 23:59:59.000001");
45
explain extended select makedate(1997,1), microsecond("1997-12-31 23:59:59.000001");
132
48
# Test of date_format()