Format output of time from a datetime field

I'm extracting data from sql server and need to output the data in a specific order and format.  The field I'm having trouble with is defined in sql server as a datetime field (8).  My extract requires the time to be formatted as a numeric 4 chars, as in military time with leading zeros, so 8:00 should appear as 0800   Here is my current statement:

Convert(varchar(10),dbo.calendar.start_time,108) as BegTime
which returns 08:00:00

I can't figure out if there is a style parameter that will give me what I need.
zknollAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sm394Commented:
i am not sure aobut style param
but this may help
select convert(varchar(2), DATEPART(hour, getdate())) + convert(varchar(2), DATEPART(minute, getdate()))
0
dhanushkadCommented:

SELECT REPLACE(SUBSTRING(CONVERT(CHAR(8),GETDATE(),8) , 1,5),':','')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sm394Commented:
here format options in detail
http://doc.ddart.net/mssql/sql70/ca-co_1.htm
0
zknollAuthor Commented:
convert(varchar(2), DATEPART(hour, getdate())) + convert(varchar(2), DATEPART(minute, getdate()))

This works for a time like 10:30.  The output is 1030 but if the time is 8:00:00 the output is 80 so I'm missing the leading 0 before the 8 and the second 0 for the minute.
0
zknollAuthor Commented:
It would have easier to understand if you referenced by field in the solution.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.