diff options
author | gluh@gluh.mysql.r18.ru <> | 2003-11-17 18:02:08 +0400 |
---|---|---|
committer | gluh@gluh.mysql.r18.ru <> | 2003-11-17 18:02:08 +0400 |
commit | 5ade64831eabf6c5e99df9890f7c8fded2b710d0 (patch) | |
tree | 1938e6b15b2f83f5ed4daaaf3037a102080b9eb6 /sql/item_timefunc.cc | |
parent | a1199c7749954679b278591046b86ffeb65be0e1 (diff) | |
download | mariadb-git-5ade64831eabf6c5e99df9890f7c8fded2b710d0.tar.gz |
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; +} |