In the process of developing the project, the website requires the input of some dates, such as the current year, month and day. Here are some arrays I have compiled for you that are used daily to obtain date and time.
Get the year from the beginning to the present
In the process of developing the project, the website requires the input of some dates, such as the year, month and day to date. Here are some daily uses that I have compiled for you. Array of datetimes.
Get the year from the beginning to the present
function yearArray(){ $tody = getdate(); $todyYear = $tody['year']; $startYear = 1900-1; $i = 1; for($startYear; $startYear < $todyYear; $startYear++){ $yearArr[$i] = $startYear+1; $i++; } return $yearArr; }
Get the array of 12 months
function monthArray(){ $monthArr = array(1,2,3,4,5,6,7,8,9,10,11,12); return $monthArr; }
Get all the days of a month Array
function dayArray(){ $dayArr = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31); return $dayArr; }
Get the array from Monday to Sunday
function weekArr(){ return array('1'=>'星期一','2'=>'星期二','3'=>'星期三','4'=>'星期四','5'=>'星期五','6'=>'星期六','7'=>'星期日');