Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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....
Posted
Updated 2-Apr-13 7:36am
v4
Comments
Richard C Bishop 1-Apr-13 9:52am    
Post the code you are using to achieve what you have so far. We can help by looking at it. Use the "Improve question" widget to add it.
ZurdoDev 2-Apr-13 14:21pm    
If it is in a gridview and a dataformatstring. But without showing relevant code how can we help?

1 solution

Here is some code that might help
SQL
, 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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900