我想将当前月份分为几周,比如第一天到周六,然后是周日到下周六.对于前者:对于五月份,所以我想把它分开
2016-05-01 to 2016-05-07
2016-05-08 to 2016-05-14
2016-05-15 to 2016-05-21
2016-05-22 to 2016-05-28
2016-05-29 to 2016-05-31
Run Code Online (Sandbox Code Playgroud)
如果我尝试下面的代码,我没有得到确切的结果.
<?php
$start_date = date('Y-m-d', strtotime('2016-06-01'));
$end_date = date('Y-m-d', strtotime('2016-06-30'));
$i=1;
for($date = $start_date; $date <= $end_date; $date = date('Y-m-d', strtotime($date. ' + 7 days'))) {
echo getWeekDates($date, $start_date, $end_date, $i);
echo "\n";
$i++;
}
function getWeekDates($date, $start_date, $end_date, $i) {
$week = date('W', strtotime($date));
$year = date('Y', strtotime($date));
$from = date("Y-m-d", strtotime("{$year}-W{$week}+1"));
if($from < $start_date) $from = $start_date;
$to = date("Y-m-d", strtotime("{$year}-W{$week}-7"));
if($to …Run Code Online (Sandbox Code Playgroud) 我在我的SASS文件中有这个:
.buttons {
:first-child {
padding-top:7px;
}
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="buttons">
<div>
<label>
<input type="checkbox">
bla blaa
</label>
</div>
<div>
<a class="advance">Step2</a>
<button class="btn">help <i class="arrow"></i></button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
然而,箭头孩子正受到影响padding.我只想要父母中的第一个孩子.button.
我也试过这个:
.buttons {
&:first-child {
padding-top:5px;
}
}
Run Code Online (Sandbox Code Playgroud)