converting StartTime to Military time format

  • 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!!


    Thank you!!,

    Angelindiego

  • Are you sure you need a military time conversion?

    Will datediff( minute , @startdate , @enddate ) give you what you need?

  • 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.....


    Thank you!!,

    Angelindiego

  • declare @starttime varchar(10), @stoptime int

    set @starttime = '16:30'

    set @stoptime = 1249

    select duration = @stoptime - datediff(n,0,@starttime)

  • Sweet! This worked!! Now I think all I have to do is convert the time passed in to military time and run this code! Thank you so much!!!


    Thank you!!,

    Angelindiego

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply