Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Rounding Off Datetimes - SQL Server

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: Thu, Oct 13, 2016, 10:15 AM


declare @BaseDate datetime = '2016-01-01'

select top 10 
     BatchDate = dateadd(SECOND, datediff(SECOND, @BaseDate, UpdatedOn), @BaseDate)
    ,Qty = count(2)
from
    dbo.UploadedData
where 1=1
    and UpdatedOn >= '2016-10-10'
group by
    dateadd(SECOND, datediff(SECOND, @BaseDate, UpdatedOn), @BaseDate)

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.