Format output of time from a datetime field
Posted on 2008-11-05
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.