SQL Server conversion for TO_DATE

How to convert this oracle syntax to SQL server 2008 R2

select (TO_DATE('1040' ,'HH24MI') - TO_DATE('1020','HH24MI')) from dual;

Oracle Output: 0.0138888888888888888888888888888888888889

Im doing Oracle to SQL server Migration. need to replicate the same result .

SELECT DATEDIFF(minute, '19000101 10:20', '19000101 10:40')

1 Like

thanks for your reply.
But when i run this Oracle query it give different result in Oracle.

select (TO_DATE('1040' ,'HH24MI') - TO_DATE('1020','HH24MI')) from dual;
Result:0.0138888888888888888888888888888888888889

Im doing Oracle to SQL server Migration. need to replicate the same result .

select datediff(minute, cast('10:20' as time), cast('10:40' as time)) / (60.0 * 24) /* 60 * 24=#ofmins_in_a_day */

1 Like

Thanks a lot Scott Pletcher