summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc16
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(&ltime,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, &ltime, str))
+ return str;
+ }
+ return 0;
+}