459
select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
461
2003-01-02 10:11:12.001200
462
create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
463
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
464
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
465
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
467
Field Type Null Key Default Extra
475
2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
477
create table t1 select "02 10" as a, "%d %H" as b;
478
select str_to_date(a,b) from t1;
481
create table t2 select str_to_date(a,b) from t1;
483
Field Type Null Key Default Extra
484
str_to_date(a,b) datetime YES NULL
485
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
486
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
487
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
488
str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
489
str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
490
str_to_date("02 10", "%d %f") as f6;
492
2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12 58:11:12 48:00:00.100000
494
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
496
select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
497
addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
498
microsecond("1997-12-31 23:59:59.01XXXX") as f3;
499
ERROR HY000: Received an invalid datetime value '1997-12-31 23:59:59.01XXXX'.
500
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
501
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
503
2003-04-05 2003-04-05 10:11:12.101010
505
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
506
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
507
459
create table t1 (f1 datetime);
508
460
insert into t1 (f1) values ("2005-01-01");
509
461
insert into t1 (f1) values ("2005-02-01");