CREATE FUNCTION [dbo].[TimeOnly](@DateTime DateTime) returns datetime as begin return @DateTime - dbo.DateOnly(@DateTime) end go