15,961,844 members
See more:
SQL
```declare @Table1 TABLE
( TimeSchedule time ,
Duration time ,
EnteredOn datetimeoffset )

Insert @Table1 values ( CAST(0x00907E0000000000 AS Time), CAST(0x0008070000000000 AS Time),'2015-11-24')

Insert @Table1 values ( CAST(0x00A08C0000000000 AS Time), CAST(0x0008070000000000 AS Time),'2015-11-24')

SELECT CONCAT(CONVERT(DATE,EnteredOn), ' ' , TimeSchedule,' to ', (CONVERT(VARCHAR(8),CONVERT(DATETIME,TimeSchedule)+ CONVERT(DATETIME,Duration),108)) ) AS Daytime FROM @Table1```

OUTPUT:
2015-11-24 09:00:00 to 09:30:00
2015-11-24 10:00:00 to 10:30:00

I want my output as 2015-11-24 09:00:00 to 10:30:00. Plz help me to find ts.
Posted
Updated 23-Nov-15 20:44pm
v2
Tomas Takac 24-Nov-15 2:47am
You need to insert duration of 1h 30m instead of just 30m. That will solve your problem.

## Solution 1

Hi,

SQL
```declare @Table1 TABLE
( TimeSchedule time ,
Duration time ,
EnteredOn datetimeoffset )

Insert @Table1 values ( CAST(0x00907E0000000000 AS Time), CAST(0x0008070000000000 AS Time),'2015-11-24')

Insert @Table1 values ( CAST(0x00A08C0000000000 AS Time), CAST(0x0008070000000000 AS Time),'2015-11-24')

SELECT CONCAT(CONVERT(DATE,EnteredOn), ' ' , TimeSchedule,' to ', (CONVERT(VARCHAR(8),dateadd(hh,CAST(CONVERT(DATETIME,TimeSchedule ) AS bigint),'1/1/1970 10:00:00')  + CONVERT(DATETIME,Duration),108)) ) AS Daytime FROM @Table1```