summaryrefslogtreecommitdiff
path: root/mysql-test/t/date_formats.test
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-08-06 10:01:29 +0400
committerunknown <dlenev@brandersnatch.localdomain>2004-08-06 10:01:29 +0400
commit1b0f0b0afc6cf33db2b39bf2653bf6f6ddef015b (patch)
treeb0d57ecd55aa0d92a2dc378c028c3acd6b14ab89 /mysql-test/t/date_formats.test
parentea8ac8ab9845e039e5770821c5dbfc4604390299 (diff)
downloadmariadb-git-1b0f0b0afc6cf33db2b39bf2653bf6f6ddef015b.tar.gz
Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code. mysql-test/r/date_formats.result: Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also some other specifiers for which tests were missing previously. mysql-test/t/date_formats.test: Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also some other specifiers for which tests were missing previously. sql/item_timefunc.cc: Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time() function. Also simplified a bit calculation of dates from week number.
Diffstat (limited to 'mysql-test/t/date_formats.test')
-rw-r--r--mysql-test/t/date_formats.test18
1 files changed, 14 insertions, 4 deletions
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 1fc04cb907b..2e6e1fabd8d 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -132,16 +132,23 @@ insert into t1 values
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
('10:20:10', '%H:%i:%s'),
('10:20:10', '%h:%i:%s.%f'),
+('10:20:10', '%T'),
('10:20:10AM', '%h:%i:%s%p'),
+('10:20:10AM', '%r'),
('10:20:10.44AM', '%h:%i:%s.%f%p'),
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
('15 September 2001', '%d %M %Y'),
('15 SEPTEMB 2001', '%d %M %Y'),
('15 MAY 2001', '%d %b %Y'),
+('15th May 2001', '%D %b %Y'),
('Sunday 15 MAY 2001', '%W %d %b %Y'),
('Sund 15 MAY 2001', '%W %d %b %Y'),
('Tuesday 00 2002', '%W %U %Y'),
('Thursday 53 1998', '%W %u %Y'),
+('Sunday 01 2001', '%W %v %x'),
+('Tuesday 52 2001', '%W %V %X'),
+('060 2004', '%j %Y'),
+('4 53 1998', '%w %u %Y'),
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
@@ -156,7 +163,7 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1;
select date,format,TIME(str_to_date(date, format)) as time from t1;
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
-# Test wrong dates
+# Test wrong dates or converion specifiers
truncate table t1;
insert into t1 values
@@ -169,10 +176,13 @@ insert into t1 values
('15 Septembei 2001', '%d %M %Y'),
('15 Ju 2001', '%d %M %Y'),
('Sund 15 MA', '%W %d %b %Y'),
-('Sunday 01 2001', '%W %V %X'),
('Thursdai 12 1998', '%W %u %Y'),
-(NULL, get_format(DATE,'USA')),
-('Tuesday 52 2001', '%W %V %X');
+('Sunday 01 2001', '%W %v %X'),
+('Tuesday 52 2001', '%W %V %x'),
+('Tuesday 52 2001', '%W %V %Y'),
+('Tuesday 52 2001', '%W %u %x'),
+('7 53 1998', '%w %u %Y'),
+(NULL, get_format(DATE,'USA'));
select date,format,str_to_date(date, format) as str_to_date from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;