我有两个日期列, effdate和enddate,并需要在第三栏中获取两个日期之间的日期列表。
例如,
effdate | enddate
2012-09-01 |2019-06-11
2012-10-02 |2012-08-31
我想获得这两个日期之间的列表日期作为第三列
答案 0 :(得分:0)
递归CTE是一种非常简单的方法:
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
float: right;
}
/* Hide default HTML checkbox */
.switch input {
display: none;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input.success:checked+.slider {
background-color: #8bc34a;
}
input:checked+.slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
理货单通常具有更好的性能:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="container">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="card" style="margin: 10px 0">
</div>
</div>
<button id="btn" class="btn btn-default commonButton" type="submit">
<i class="fa fa-search"></i> Go
</button>
</div>
您必须确保您的数字表(无论生成多少)对于您的时间跨度来说都是足够的。
答案 1 :(得分:0)
您可以尝试此操作以获取所需的日期列表-
DECLARE @D1 DATETIME = '20190601'
DECLARE @D2 DATETIME = '20190611'
DECLARE @LoopCount INT = (SELECT DATEDIFF(DD,@D1,@D2))
DECLARE @TempTable TABLE
(
date date
)
WHILE @LoopCount >= 0
BEGIN
INSERT INTO @TempTable (date)
VALUES (DATEADD(DD,-@LoopCount,GETDATE()))
SET @LoopCount = @LoopCount - 1
END
SELECT * FROM @TempTable