Windows Vista Forums

time calculations

  1. #1


    Stevie Guest

    time calculations

    I need to add hours & minutes, i.e. 1020:00 + 1020:00 = 2040:00. (HHHH:MM)
    Excel calculates it using a 24 hour clock and I don't get the results I'm
    looking for.
    Do I need a formula to convert the time?
    Or, would there be a special cell format.
    --
    Stevie



      My System SpecsSystem Spec

  2. #2


    Dale Atkin Guest

    Re: time calculations

    Why not convert from hours and minutes to hours, and fractions of hours, and
    then back again.

    So 10:45 + 10:30---> 10.75+10.5=21.25 ---> 21:15.

    Dale

    "Stevie" <StevieO@xxxxxx> wrote in message
    news:BF868F1C-1963-47EA-8E48-8EA7EA55DF4E@xxxxxx

    >I need to add hours & minutes, i.e. 1020:00 + 1020:00 = 2040:00. (HHHH:MM)
    > Excel calculates it using a 24 hour clock and I don't get the results I'm
    > looking for.
    > Do I need a formula to convert the time?
    > Or, would there be a special cell format.
    > --
    > Stevie

      My System SpecsSystem Spec

  3. #3


    Family Tree Mike Guest

    Re: time calculations

    "Stevie" <StevieO@xxxxxx> wrote in message
    news:BF868F1C-1963-47EA-8E48-8EA7EA55DF4E@xxxxxx

    >I need to add hours & minutes, i.e. 1020:00 + 1020:00 = 2040:00. (HHHH:MM)
    > Excel calculates it using a 24 hour clock and I don't get the results I'm
    > looking for.
    > Do I need a formula to convert the time?
    > Or, would there be a special cell format.
    > --
    > Stevie

    Are you trying to do this in Excel? If so, you should ask in an Office or
    Excel newsgroup.

    This is a programming group, so, as such, I would use a TimeSpan object as
    follows:

    static void Main(string[] args)
    {
    TimeSpan ts1 = new TimeSpan(10, 45, 0);
    TimeSpan ts2 = new TimeSpan(10, 30, 0);
    TimeSpan ts3 = ts1.Add(ts2);
    int H = (int) Math.Floor(ts3.TotalHours);
    double M = ts3.TotalMinutes - (60 * H);
    Console.WriteLine(string.Format("{0}:{1}", H, M));
    Console.ReadLine();
    }


    --
    Mike


      My System SpecsSystem Spec

time calculations

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Zone - Restore Missing Time Zones Brink Tutorials 0 29 Nov 2008
Windows System Time and Desktop time not matching up Coloradokittykitten Vista General 2 09 Jul 2008
Date time calculations Snowmizer PowerShell 11 18 Apr 2008
Internet Time Synchronization Incorrect - Showing Standard Time Alice PowerShell 2 28 Oct 2007
Demo of getting/setting time from an RFC867 time source Alex K. Angelopoulos [MVP] PowerShell 0 16 Sep 2006