基于开始日期和日期的周计算

时间:2018-04-05 05:57:50

标签: mysql mysql-workbench

我需要根据给定的开始日期和周的开始日期(星期一/星期日)计算给定财政年度的日期周,即如果我将开始日设置为星期一我的周应该从星期一开始。并且还需要显示周日期是否每周关闭

周计算配置表如下: -

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    text-align: left;    
}
</style>
</head>
<body>

<table style="width:100%">
  <tr>
    <th>Start_Date</th>
    <th>Week_Start</th>
  </tr>
  <tr>
    <td>04-04-2018</td>
    <td>Monday</td>
  </tr>
</table>

</body>
</html>

每周关闭配置表,显示当天是否每周关闭一个标志: -

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    text-align: left;    
}
</style>
</head>
<body>

<table style="width:100%">
  <tr>
    <th>Day</th>
    <th>Frequency</th>
  </tr>
  <tr>
    <td>Sunday</td>
    <td>Weekly</td>
  </tr>
   <tr>
    <td>Saturday</td>
    <td>Bi Weekly 15</td>
  </tr>
</table>

</body>
</html>

需要结果如: -

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    text-align: left;    
}
</style>
</head>
<body>

<table style="width:100%">
  <tr>
    <th>Date</th>
    <th>WeekNumber</th>
    <th>WeekOff</th>
  </tr>
  <tr>
    <td>04-04-2018</td>
    <td>WK1</td>
    <td>false</td>
  </tr>
    <tr>
    <td>05-04-2018</td>
    <td>WK1</td>
    <td>false</td>
  </tr>
    <tr>
    <td>06-04-2018</td>
    <td>WK1</td>
    <td>false</td>
  </tr>
    <tr>
    <td>07-04-2018</td>
    <td>WK1</td>
    <td>false</td>
  </tr>
    <tr>
    <td>08-04-2018</td>
    <td>WK1</td>
    <td>true</td>
  </tr>
    <tr>
    <td>09-04-2018</td>
    <td>WK2</td>
    <td>false</td>
  </tr>
    <tr>
    <td>-----</td>
    <td>-----</td>
    <td>-----</td>
  </tr>
  <tr>
    <td>31-03-2019</td>
    <td>WK52</td>
    <td>false</td>
  </tr>
</table>

</body>
</html>

0 个答案:

没有答案