어제이 회전 달력을 설정했는데 문제가 발생할 수 있으며 문제가 발생할 수 있다고 생각했습니다. 오늘 문제가 발생했습니다. 날짜가 바뀌면 날짜가 바뀌 었습니다. 어제처럼 주말을 뛰어 넘는 대신 월요일이 아닌 토요일을 보였다. 월요일 ~ 금요일, +3시, 월요일 ~ 금요일까지만 표시하는 것으로 가정합니다. 예제 코드 :php date 함수와 주말에 주말을 계산하는 요일을 계산하지 않아야합니다.
echo "Today";
echo date('m/d');
echo "<br>";
echo substr(date('l/m/d', strtotime('+1 day')), 0, 2). date('m/d', strtotime('+1 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+2 day')), 0, 1). date('m/d', strtotime('+2 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+5 day')), 0, 1). date('m/d', strtotime('+5 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+6 day')), 0, 1). date('m/d', strtotime('+6 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+7 day')), 0, 1). date('m/d', strtotime('+7 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+8 day')), 0, 2). date('m/d', strtotime('+8 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+9 day')), 0, 1). date('m/d', strtotime('+9 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+12 day')), 0, 1). date('m/d', strtotime('+12 day'));
echo "<br>";
echo substr(date('l/m/d', strtotime('+13 day')), 0, 1). date('m/d', strtotime('+13 day'));
분명히 모드 내가 어떻게 주말은 항상 생략되도록 할 수 있습니다, 일을 점점 아닌가요?
또한, 정말 같은 SQL 쿼리에이 concating 해요 : (실제 코드)
sum(case when cast(a.follow_up as date)=cast(GETDATE() as date) then 1 else 0 end) 'Today<br> " . date('m/d') . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='1' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+1 day')), 0, 2).'<br>' . date('m/d', strtotime('+1 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='2' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+2 day')), 0, 1).'<br>' . date('m/d', strtotime('+2 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='3' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+5 day')), 0, 1).'<br>' . date('m/d', strtotime('+5 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='4' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+6 day')), 0, 1).'<br>' . date('m/d', strtotime('+6 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='5' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+7 day')), 0, 1).'<br>' . date('m/d', strtotime('+7 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='6' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+8 day')), 0, 2).'<br>' . date('m/d', strtotime('+8 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='7' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+9 day')), 0, 1).'<br>' . date('m/d', strtotime('+9 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='8' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+12 day')), 0, 1).'<br>' . date('m/d', strtotime('+12 day')) . "',
sum(case when DATEDIFF(dd,cast(GETDATE() as date),cast(a.follow_up as date))='9' then 1 else 0 end) '" . substr(date('l/m/d', strtotime('+13 day')), 0, 1).'<br>' . date('m/d', strtotime('+13 day')) . "',
', strtotime으로는 월요일입니다 ", $ lastmonday); – Waygood
"l/m/d "를 자르지 않고'date ("D m/d ");를 쓸 수 있습니다. – Waygood
그 대답은 제가 좋은 방법일지도 모릅니다. 그것에게 가라. 고맙습니다. –