I simplified my original code to eliminate three DATEADD function calls and one NULLIF function call, so it might run a bit faster.
select
next_run_date ,
next_run_time ,
NEXT_RUN_DATETIME =
dateadd(mm,((next_run_date)/100%100)-1,
dateadd(yy,(nullif(next_run_date,0)/10000)-1900,
dateadd(ss,
-- Seconds
(next_run_time%100)+
-- Minutes
(((next_run_time/100)%100)*60)+
-- Hours
((next_run_time/10000)*3600)+
-- Days
(((next_run_date)%100)-1)*86400
,0)))
from
msdb.dbo.sysjobschedules AS s
next_run_date next_run_time NEXT_RUN_DATETIME
------------- ------------- -----------------------
20120109 170000 2012-01-09 17:00:00.000
20120109 170000 2012-01-09 17:00:00.000
20120204 20000 2012-02-04 02:00:00.000
20100718 83033 2010-07-18 08:30:33.000
20120110 100 2012-01-10 00:01:00.000
20120114 30000 2012-01-14 03:00:00.000
20120121 23000 2012-01-21 02:30:00.000
20100821 142000 2010-08-21 14:20:00.000
0 0 NULL
20120109 105000 2012-01-09 10:50:00.000
20091104 100000 2009-11-04 10:00:00.000
20120115 200 2012-01-15 00:02:00.000
0 0 NULL
20120110 90000 2012-01-10 09:00:00.000
20120115 150000 2012-01-15 15:00:00.000
20120110 30000 2012-01-10 03:00:00.000