Agent_DateTime function to format rundate,runtime from sysjobhistory

In MSDB, sysjobhistory table logs rundate and runtime information but in YYYYMMDD and HHMMSS format. To report this information in YYYY-MM-DD HH:MM:SS:mmm format, we can use agent_datetime function.

Select Name,msdb.dbo.agent_datetime(run_date,run_time) as [JobStart_DateTime],run_status
from msdb.dbo.sysjobs A INNER JOIN msdb.dbo.sysjobhistory B on A.job_id=B.job_id