diff options
author | unknown <gluh@gluh.mysql.r18.ru> | 2003-11-17 18:02:08 +0400 |
---|---|---|
committer | unknown <gluh@gluh.mysql.r18.ru> | 2003-11-17 18:02:08 +0400 |
commit | f6f06ef7a9382d14da843c81dcedbb7809ad72dc (patch) | |
tree | 1938e6b15b2f83f5ed4daaaf3037a102080b9eb6 /sql/item_timefunc.cc | |
parent | 1ac15163a7b201c44f28a63b7129d8144732ce12 (diff) | |
download | mariadb-git-f6f06ef7a9382d14da843c81dcedbb7809ad72dc.tar.gz |
WL#1253: LAST_DAY
mysql-test/r/func_time.result:
Test for WL#1253: LAST_DAY
mysql-test/t/func_time.test:
Test for WL#1253: LAST_DAY
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index cf71f2b3bef..bcb7ddb1054 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2310,3 +2310,19 @@ String *Item_func_str_to_date::val_str(String *str) return str; return 0; } + + +String *Item_func_last_day::val_str(String *str) +{ + TIME ltime; + if (!get_arg0_date(<ime,0)) + { + uint month_idx= ltime.month-1; + ltime.day= days_in_month[month_idx]; + if ( month_idx == 1 && calc_days_in_year(ltime.year) == 366) + ltime.day+= 1; + if (!make_datetime(DATE_ONLY, <ime, str)) + return str; + } + return 0; +} |