w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Combine date and time in SQL Server in SELECT query

Use DATEADD:

SELECT
   DATEADD(HOUR, 18, CAST(CAST(FromDate AS DATE) AS DATETIME)) as StartDT 
FROM
   WsWmpLeaveReason

See the freely available, comprehensive SQL Server Books Online documentation for more details on DATEADD and its options





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.