UFN_DATE_GETEARLIESTTIME

Return

Return Type
datetime

Parameters

Parameter Parameter Type Mode Description
@DATE datetime IN

Definition

Copy


CREATE function dbo.[UFN_DATE_GETEARLIESTTIME]
(
  @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.

  --No need to cast the return value back to "datetime" because the function will implicitly do it.

  return cast(@DATE as date);
end