* ** Obtain the timestamp of the last day of the week * @ paramstring $ type * @ returninteger * publicfunctionget_week_time ($ type = & amp; 39; first & amp; 39 ;) {*
/*** Get the timestamp of the first day of the week/Last Day * @ param string $ type * @ return integer */public function get_week_time ($ type = 'first ') {/* obtain the timestamp of the first day of the Week/Last Day */$ year = date ("Y"); $ month = date ("m "); $ day = date ('w'); $ nowMonthDay = date ("t"); if ($ type = 'first') {$ firstday = date ('D ') -$ day; if (substr ($ firstday, 0, 1) = "-") {$ firstMonth = $ month-1; $ lastMonthDay = date ("t ", $ firstMonth); $ firstday = $ lastMonthDay-substr ($ firstday, 1); $ time_1 = strtotime ($ year. "-". $ firstMonth. "-". $ firstday);} else {$ time_1 = strtotime ($ year. "-". $ month. "-". $ firstday);} return $ time_1;} else {$ lastday = date ('D') + (7-$ day); if ($ lastday> $ nowMonthDay) {$ lastday = $ lastday-$ nowMonthDay; $ lastMonth = $ month + 1; $ time_2 = strtotime ($ year. "-". $ lastMonth. "-". $ lastday);} else {$ time_2 = strtotime ($ year. "-". $ month. "-". $ lastday) ;}return $ time_2 ;}} /*** obtain the timestamp of the first or last day of the month * @ param string $ type * @ return integer */public function get_month_time ($ type = 'first ') {/* obtain the timestamp of the first or last day of the month */$ year = date ("Y"); $ month = date ("m "); $ allday = date ("t"); if ($ type = 'first') {$ start_time = strtotime ($ year. "-". $ month. "-1"); return $ start_time;} else {$ end_time = strtotime ($ year. "-". $ month. "-". $ allday); return $ end_time ;}}