Skip to content

Instantly share code, notes, and snippets.

@kwestground
Created February 3, 2016 12:05
Show Gist options
  • Save kwestground/255d260c6426930f5024 to your computer and use it in GitHub Desktop.
Save kwestground/255d260c6426930f5024 to your computer and use it in GitHub Desktop.
CREATE FUNCTION SBODateTimeToSQLDateTime
(
@Date datetime, @Time smallint
)
RETURNS datetime
AS
BEGIN
DECLARE
@Hour smallint = CAST(SUBSTRING(CAST(@Time as varchar(4)), 1, 2) AS smallint),
@Minute smallint = CAST(SUBSTRING(CAST(@Time as varchar(4)), 3, 2) AS smallint)
RETURN DATEADD(MINUTE, @Minute, DATEADD(HOUR, @Hour, @Date))
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment