如何在gridview中的sp_help_job中查找日期和时间格式 [英] How to chage the date and time format in sp_help_job in gridview

查看:75
本文介绍了如何在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....

推荐答案

下面是一些可能有用的代码

Here is some code that might 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中查找日期和时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆