--- --------------------------------------------------------------------------------------- ----
Blog Entry:
Getting Only The Date Part Of A Date/Time Stamp in SQL Server (Revisited)
Author:
Ben Nadel / Kinky Solutions
Link:
http://www.bennadel.com/index.cfm?dax=blog:963.view
Date Posted:
Sep 21, 2007 at 8:01 AM
---- --------------------------------------------------------------------------------------- --->
SELECT
h.id,
h.date_created,
(
CAST(
FLOOR(
CAST(
h.date_created
AS FLOAT
)
)
AS DATETIME
)
) AS date_only_created
FROM
web_stats_hit h
#qHit.RecordCount#
#qHit.date_created#
#qHit.date_only_created#
SELECT
h.id,
h.date_created,
(
DATEADD(
DD,
0,
DATEDIFF(
DD,
0,
h.date_created
)
)
) AS date_only_created
FROM
web_stats_hit h
#qHit.RecordCount#
#qHit.date_created#
#qHit.date_only_created#