本文介绍了如何在gridview中的sp_help_job中查找日期和时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Gridview中显示sp_help_job数据。

列last_run_date是20130401,last_run_time是30000,

但我想将日期显示为mm / dd // yyyy和时间......:mm





请帮忙....

I am displaying "sp_help_job" data in a Gridview.
The columns last_run_date is 20130401 and last_run_time is 30000,
but I wanted to show date as mm/dd//yyyy and time hh:mm


Pls need ur help....

推荐答案

, CASE WHEN Last_run_date = 0 THEN NULL
        ELSE CONVERT(VARCHAR(10), CAST(CAST(Last_run_date AS VARCHAR(10)) AS DATE), 101)
        END AS LastRunDate
, CAST(LEFT(RIGHT('000000' + CAST(last_run_time AS VARCHAR(6)), 6), 2) + ':'
    + SUBSTRING(RIGHT('000000' + CAST(last_run_time AS VARCHAR(6)), 6), 3, 2) + ':'
    + RIGHT(RIGHT('000000' + CAST(last_run_time AS VARCHAR(6)), 6), 2) AS TIME)
    AS LastRunTime


这篇关于如何在gridview中的sp_help_job中查找日期和时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 04:26