PHP code example of yangjiasheng1997 / timerange
1. Go to this page and download the library: Download yangjiasheng1997/timerange library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yangjiasheng1997 / timerange example snippets angular2
$month = RangeDate::set(2020,true,'Y-m-d')->getMonth();
//获取月份返回格式 其他类似
array(12) {
[0]=>
array(3) {
["month"]=>
int(1) //月份
["start"]=>
string(10) "2020-01-01"//每个月开始时间 当天零点
["end"]=>
string(10) "2020-01-31" 每个月结束时间 当天的23:59:59
}
[1]=>
array(3) {
["month"]=>
int(2)
["start"]=>
string(10) "2020-02-01"
["end"]=>
string(10) "2020-02-29"
}
}
$hours = RangeTime::set('2020-04-26',true)->getHours('8:30',['08:30','17:00'],['12:30','13:30'],3600);
//获取时间段返回格式
array(2) {
["hours"]=>
array(7) {
[0]=>
string(5) "08:30"
[1]=>
string(5) "09:30"
[2]=>
string(5) "10:30"
[3]=>
string(5) "11:30"
[6]=>
string(5) "14:30"
[7]=>
string(5) "15:30"
[8]=>
string(5) "16:30"
}
["info"]=>
array(7) {
[0]=>
array(2) {
["start"]=>
string(5) "08:30"
["end"]=>
string(5) "09:29"
}
[1]=>
array(2) {
["start"]=>
string(5) "09:30"
["end"]=>
string(5) "10:29"
}
[2]=>
array(2) {
["start"]=>
string(5) "10:30"
["end"]=>
string(5) "11:29"
}
[3]=>
array(2) {
["start"]=>
string(5) "11:30"
["end"]=>
string(5) "12:29"
}
[6]=>
array(2) {
["start"]=>
string(5) "14:30"
["end"]=>
string(5) "15:29"
}
[7]=>
array(2) {
["start"]=>
string(5) "15:30"
["end"]=>
string(5) "16:29"
}
[8]=>
&array(2) {
["start"]=>
string(5) "16:30"
["end"]=>
string(5) "17:29"
}
}
}