UFN_DATE_GETLATESTTIME
Return
Return Type |
---|
datetime |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@DATE | datetime | IN |
Definition
Copy
CREATE function dbo.[UFN_DATE_GETLATESTTIME]
(
@DATE datetime
)
returns datetime
with execute as caller
as
begin
--Casting to a "date" is the most efficient way to truncate the time and get the earliest time for a given date.
--Then we must add 1 day and subtract 003 ms in order to get the latest possible time for a given date.
return dateadd(ms, -003, dateadd(d, 1, cast(cast(@DATE as date) as datetime)));
end