890
890
return (str != end);
893
int64_t Item_func_month::val_int()
897
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
898
return (int64_t) ltime.month;
902
String* Item_func_monthname::val_str(String* str)
905
const char *month_name;
906
uint32_t month= (uint) val_int();
907
Session *session= current_session;
909
if (null_value || !month)
915
month_name= session->variables.lc_time_names->month_names->type_names[month-1];
916
str->set(month_name, strlen(month_name), system_charset_info);
922
Returns the quarter of the year.
925
int64_t Item_func_quarter::val_int()
929
if (get_arg0_date(<ime, TIME_FUZZY_DATE))
931
return (int64_t) ((ltime.month+2)/3);
934
int64_t Item_func_hour::val_int()
938
(void) get_arg0_time(<ime);
942
int64_t Item_func_minute::val_int()
946
(void) get_arg0_time(<ime);
951
Returns the second in time_exp in the range of 0 - 59.
953
int64_t Item_func_second::val_int()
957
(void) get_arg0_time(<ime);
962
uint32_t week_mode(uint32_t mode)
964
uint32_t week_format= (mode & 7);
965
if (!(week_format & WEEK_MONDAY_FIRST))
966
week_format^= WEEK_FIRST_WEEKDAY;
972
The bits in week_format(for calc_week() function) has the following meaning:
973
WEEK_MONDAY_FIRST (0) If not set Sunday is first day of week
974
If set Monday is first day of week
975
WEEK_YEAR (1) If not set Week is in range 0-53
977
Week 0 is returned for the the last week of the previous year (for
978
a date at start of january) In this case one can get 53 for the
979
first week of next year. This flag ensures that the week is
980
relevant for the given year. Note that this flag is only
981
releveant if WEEK_JANUARY is not set.
983
If set Week is in range 1-53.
985
In this case one may get week 53 for a date in January (when
986
the week is that last week of previous year) and week 1 for a
989
WEEK_FIRST_WEEKDAY (2) If not set Weeks are numbered according
991
If set The week that contains the first
992
'first-day-of-week' is week 1.
994
ISO 8601:1988 means that if the week containing January 1 has
995
four or more days in the new year, then it is week 1;
996
Otherwise it is the last week of the previous year, and the
1001
int64_t Item_func_week::val_int()
1006
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
1008
return (int64_t) calc_week(<ime,
1009
week_mode((uint) args[1]->val_int()),
1014
894
int64_t Item_func_yearweek::val_int()