November 13, 2007 at 5:17 pm
Hi all! I need to build a function that I can pass in "StartTime" varchar(10), convert it to military time, multiply the hours (16:00 = 16(hours past midnight) )by 60 and then subtract that figure from a "StopTime"(minutes past midnight, integer) for a "DurationMinutes" value. Anything like this out there already?? Any help is appreciated! Thanks!!
November 13, 2007 at 5:31 pm
Are you sure you need a military time conversion?
Will datediff( minute , @startdate , @enddate ) give you what you need?
November 13, 2007 at 7:16 pm
Oh how I wish it were that easy!! LOL... I need to convert it to military time, multiply the hours by 60 to get minutes and then subtract it from another minutes column to get the difference for the "duration" of the upload. All calculations are based on midnight and the amount of minutes since that time.....
November 14, 2007 at 7:52 am
declare @starttime varchar(10), @stoptime int
set @starttime = '16:30'
set @stoptime = 1249
select duration = @stoptime - datediff(n,0,@starttime)
November 14, 2007 at 9:00 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply