April 26, 2005 at 11:57 am
I need a function to convert SQL server date/time format to zulu time format that would include leading and trailing zeros. For example, 6/8/2004 9:34:20 AM converted to 093420. Any help would be greatly appreciated.
I had been using the following function which does not include leading and/or trailing zeros:
CREATE function [dbo].[fn_DateTime2ZuluTime] (@date datetime)
returns int
as
begin
declare @timeint int
select @timeint = (datepart(hour, @date) * 010000) +
(datepart(minute, @date) * 100) +
(datepart(second, @date))
return @timeint
end
April 26, 2005 at 12:09 pm
I have no clue of what are the rules for zulu time but:
select replace(convert (varchar(8), @date, 14),':','')
You are aware that you are changing datetime to time only, right?
* Noel
April 26, 2005 at 1:24 pm
Actually the term zulu refers to greenwich (mean time) and not the format
April 26, 2005 at 1:46 pm
Yes, I only concerned with the time portion of date/time.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply