mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
merge with 5.1-micro
This commit is contained in:
@@ -15,10 +15,10 @@ current_time(3) 01:01:01.123
|
||||
current_timestamp(4) 2011-01-01 01:01:01.1234
|
||||
localtime(5) 2011-01-01 01:01:01.12345
|
||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||
time_to_sec('12:34:56') 45296
|
||||
time_to_sec('12:34:56.789') 45296.789
|
||||
time_to_sec('12:34:56') 45296.000000
|
||||
time_to_sec('12:34:56.789') 45296.789000
|
||||
select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890'));
|
||||
sec_to_time(time_to_sec('1:2:3')) 01:02:03
|
||||
sec_to_time(time_to_sec('1:2:3')) 01:02:03.000000
|
||||
sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890
|
||||
select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
|
||||
time_to_sec(sec_to_time(11111)) 11111
|
||||
@@ -48,7 +48,7 @@ t1 CREATE TABLE `t1` (
|
||||
`localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
|
||||
`localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
|
||||
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
|
||||
`time_to_sec('12:34:56.789')` double DEFAULT NULL
|
||||
`time_to_sec('12:34:56.789')` decimal(22,6) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1;
|
||||
sec_to_time(12345) 03:25:45
|
||||
@@ -63,36 +63,30 @@ current_timestamp(4) 2011-01-01 01:01:01.1234
|
||||
localtime(5) 2011-01-01 01:01:01.12345
|
||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||
time_to_sec(123456) 45296
|
||||
time_to_sec('12:34:56.789') 45296.789
|
||||
time_to_sec('12:34:56.789') 45296.789000
|
||||
drop table t1;
|
||||
select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));;
|
||||
unix_timestamp('2011-01-01 01:01:01') 1293832861
|
||||
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.12346
|
||||
unix_timestamp('2011-01-01 01:01:01') 1293832861.000000
|
||||
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.123456
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1235
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1234
|
||||
select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));;
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01.000000
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456
|
||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01
|
||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234
|
||||
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
||||
sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999)
|
||||
838:59:59.99999 838:59:59.999999 838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '3020399.9999999'
|
||||
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
||||
sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999)
|
||||
-838:59:59.99999 -838:59:59.999999 -838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-3020399.9999999'
|
||||
select 20010101000203.000000004 + interval 1 day;
|
||||
20010101000203.000000004 + interval 1 day
|
||||
2001-01-02 00:02:03.000000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '20010101000203.000000004'
|
||||
select 20010101000203.00004 + interval 1 day;
|
||||
20010101000203.00004 + interval 1 day
|
||||
2001-01-02 00:02:03.00004
|
||||
select 20010101000203.4 + interval 1 day;
|
||||
20010101000203.4 + interval 1 day
|
||||
2001-01-02 00:02:03.4
|
||||
set @a=cast('2011-01-02 12:13:14' as datetime);
|
||||
select @a + interval 1 minute;
|
||||
@a + interval 1 minute
|
||||
@@ -158,6 +152,14 @@ t4 12:13:14.1234
|
||||
t5 12:13:14.12345
|
||||
t6 12:13:14.123456
|
||||
drop table t1;
|
||||
explain extended select cast(cast(@a as datetime(4)) as time(0));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select cast(cast((@a) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
|
||||
select cast(cast(@a as time(2)) as time(6));
|
||||
cast(cast(@a as time(2)) as time(6))
|
||||
12:13:14.120000
|
||||
select CAST(@a AS DATETIME(7));
|
||||
ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
|
||||
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
||||
|
||||
Reference in New Issue
Block a user