@@ -9,86 +9,66 @@ create temporary view v as select col from values
9
9
(timestamp ' 2020-01-01 01:33:33.123Asia/Shanghai' ),
10
10
(timestamp ' 2100-01-01 01:33:33.123America/Los_Angeles' ) t(col);
11
11
12
- -- ------------------------- '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890'
13
12
select col, date_format(col, ' G GG GGG GGGG' ) from v;
14
- select col, date_format(col, ' GGGGG' ) from v;
15
13
16
14
select col, date_format(col, ' y yy yyy yyyy yyyyy yyyyyy yyyyyyy yyyyyyyy yyyyyyyyy yyyyyyyyyy' ) from v;
17
- select col, date_format(col, ' yyyyyyyyyyy' ) from v;
18
15
19
16
select col, date_format(col, ' Y YY YYY YYYY YYYYY YYYYYY YYYYYYY YYYYYYYY YYYYYYYYY YYYYYYYYYY' ) from v;
20
- select col, date_format(col, ' YYYYYYYYYYY' ) from v;
21
17
22
18
select col, date_format(col, ' q qq' ) from v;
23
- select col, date_format(col, ' qqq' ) from v;
24
19
25
20
select col, date_format(col, ' Q QQ QQQ QQQQ' ) from v;
26
- select col, date_format(col, ' QQQQQ' ) from v;
27
21
28
22
select col, date_format(col, ' M MM MMM MMMM' ) from v;
29
- select col, date_format(col, ' MMMMM' ) from v;
30
23
31
24
select col, date_format(col, ' L LL' ) from v;
32
- select col, date_format(col, ' LLL' ) from v;
33
25
34
26
select col, date_format(col, ' w ww' ) from v;
35
- select col, date_format(col, ' www' ) from v;
36
27
37
28
select col, date_format(col, ' W' ) from v;
38
- select col, date_format(col, ' WW' ) from v;
39
29
40
30
select col, date_format(col, ' u uu uuu uuuu' ) from v;
41
- select col, date_format(col, ' uuuuu' ) from v;
42
31
43
32
select col, date_format(col, ' E EE EEE EEEE' ) from v;
44
- select col, date_format(col, ' EEEEE' ) from v;
45
33
46
34
select col, date_format(col, ' F' ) from v;
47
- select col, date_format(col, ' FF' ) from v;
48
35
49
36
select col, date_format(col, ' d dd' ) from v;
50
- select col, date_format(col, ' ddd' ) from v;
51
37
52
38
select col, date_format(col, ' DD' ) from v where col = timestamp ' 2100-01-01 01:33:33.123America/Los_Angeles' ;
53
- select col, date_format(col, ' DD' ) from v;
54
39
select col, date_format(col, ' D DDD' ) from v;
55
- select col, date_format(col, ' DDDD' ) from v;
56
40
57
41
select col, date_format(col, ' H HH' ) from v;
58
- select col, date_format(col, ' HHH' ) from v;
59
42
60
43
select col, date_format(col, ' h hh' ) from v;
61
- select col, date_format(col, ' hhh' ) from v;
62
44
63
45
select col, date_format(col, ' k kk' ) from v;
64
- select col, date_format(col, ' kkk' ) from v;
65
46
66
47
select col, date_format(col, ' K KK' ) from v;
67
- select col, date_format(col, ' KKK' ) from v;
68
48
69
49
select col, date_format(col, ' m mm' ) from v;
70
- select col, date_format(col, ' mmm' ) from v;
71
50
72
51
select col, date_format(col, ' s ss' ) from v;
73
- select col, date_format(col, ' sss' ) from v;
74
52
75
53
select col, date_format(col, ' S SS SSS SSSS SSSSS SSSSSS SSSSSSS SSSSSSSS SSSSSSSSS' ) from v;
76
- select col, date_format(col, ' SSSSSSSSSS' ) from v;
77
54
78
- select col, date_format(col, ' a ' ) from v;
79
- select col, date_format(col, ' aa ' ) from v;
55
+ -- add upper function here to avoid
56
+ select col, upper ( date_format(col, ' a ' ) ) from v;
80
57
81
58
select col, date_format(col, ' VV' ) from v;
82
- select col, date_format(col, ' V' ) from v;
83
59
84
60
select col, date_format(col, ' z zz zzz zzzz' ) from v;
85
- select col, date_format(col, ' zzzzz ' ) from v;
61
+
86
62
select col, date_format(col, ' X XX XXX' ) from v;
87
63
select col, date_format(col, ' XXXX XXXXX' ) from v;
88
- select col, date_format(col, ' XXXXXX ' ) from v;
64
+
89
65
select col, date_format(col, ' Z ZZ ZZZ ZZZZ ZZZZZ' ) from v;
90
- select col, date_format(col, ' ZZZZZZ ' ) from v;
66
+
91
67
select col, date_format(col, ' O OOOO' ) from v;
92
- select col, date_format(col, ' OO ' ) from v;
68
+
93
69
select col, date_format(col, ' x xx xxx xxxx xxxx xxxxx' ) from v;
94
- select col, date_format(col, ' xxxxxx' ) from v;
70
+
71
+ -- optional pattern, but the results won't be optional for formatting
72
+ select col, date_format(col, ' [yyyy-MM-dd HH:mm:ss]' ) from v;
73
+
74
+ select col, date_format(col, " 姚123'GyYqQMLwWuEFDdhHmsSaVzZxXOV'" ) from v; -- literals
0 commit comments