/** * Gets the current time information array * @params void * @return array */function get_current_time_array () {$date = Strtotime (Date (' y-m-d ')); Date time stamp $week = (int) date (' W '); The first week of the Year $month = (int) date (' n '); Month $year = (int) date (' Y '); Year $time _array = Array (' date ' = = $date, ' Week ' = $week, ' month ' = $month, ' Ye Ar ' = $year,);} /** * Get yesterday timestamp * @params void * @return int */function get_prev_day () {return strtotime (date (' y-m-d ', Strtotime (' Last Da Y '));
or return Strtotime ("-1 Day", Date ("y-m-d"));} /** * Get last week's year with last week * @params void * @return array */function get_prev_week () { return array ( ' Week ' = = (int) Date (' W ', Strtotime (' Last week '), "Year" = = (int) date (' Y ', Strtotime (' last week ')), ); /** * Get last month's year with last month * @params void * @return array */function get_prev_month () { return array ( ' month ' = = (int) da Te (' n ', Strtotime (' last month ')), ' year ' = = (int) date (' Y ', Strtotime (' last month ')) ;}
The above describes the PHP get yesterday timestamp, the current time information array, last week and last week in the year, last month and last month in the year, including the content, want to be interested in the PHP tutorial friends helpful.