• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

DATEPART(HH,GETDATE()) AS 'SubmissionID',

Homerboy

Lifer
Why is that SQL query not outputting 24hr time?

At 9am its just outputting "9" and not "09"?

Though I guess that is technically still 24hr time? I guess I need it to output 2 digits regardless.
 
I'm sure there is an easier way to do this but it it what i came up with:
SELECT replicate('0', 2-LEN(DATEPART(HH,'1/1/11 9:00am'))) + CONVERT(varchar(2),DATEPART(HH,'1/1/11 9:00am')) AS 'SubmissionID'
 
That only accounts for 9am though. There has to be a way to make the HH component always come back as 2 digits.

Sadly it's 10am now... so kinda hard to test 🙂
 
ah crap.
It does it with minutes too.

DATEPART(HH,GETDATE()) ,
DATEPART(MI,GETDATE()) ,

just returned "10" and "3"
should be "10" and "03"

There has to be an easy way to do this.
 
Back
Top