我需要列出从今天起过去的60天。我正在使用GETDATE并列出过去60天很好,但是我不知道如何以15分钟为间隔列出每天的小时和分钟。
例如: 2018-10-07 00:00:00, 2018-10-07 00:15:00, 2018-10-07 00:30:00 等
private void swap(int first, int second) {
int buffer = Heap[first];
Heap[first] = Heap[second];
Heap[second] = buffer;
}
答案 0 :(得分:0)
尝试这样的事情:
SELECT d = DATEADD(N, rn*-15, CAST(CAST(GETDATE() as DATE) as DATETIME))
FROM
(
SELECT TOP (DATEDIFF(N, DATEADD(DD,-61,GETDATE()),GetDATE()) /15)
rn = ROW_NUMBER() OVER (ORDER BY s1.id)-1
FROM sysobjects s1
cross apply sysobjects s2
) AS x