Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!lihan From: lihan@walt.cc.utexas.edu (Bruce Bostwick) Newsgroups: comp.lang.pascal Subject: Re: Algorithm for average time of day? Message-ID: <18034@ut-emx.UUCP> Date: 6 Sep 89 16:27:44 GMT References: <1780003@hpcc01.HP.COM> Sender: news@ut-emx.UUCP Reply-To: lihan@walt.cc.utexas.edu (Bruce Bostwick) Distribution: usa Organization: The University of Texas at Austin, Austin, Texas Lines: 26 In article <1780003@hpcc01.HP.COM> azarian@hpcc01.HP.COM (Randy Azarian) writes: >Does anyone have an algorithm available that will calculate >an average time of day? > >For example: > > 4:30 > 5:30 > -> average would be 5:00 Try converting the times to decimal hours, e.g. 4:30 becomes 4.5, 5:30 becomes 5.5; then averaging those two numbers and converting back to h:mm format. If noon becomes a problem, you can remove some worries by using 24-hour decimal time -- 4:30 PM would be 16.5, etc., etc. r ======================================================================= Internet:lihan@walt.cc.utexas.edu Disclaimer: My employer doesn't MaBellNet:(512)459-1602 even know UseNet exists, let SlowNet:varies chaotically, alone that I'm on it and ex- e-mail for current value pressing opinions ... +---------------------------------------------------------------------+ (-: a.k.a. BB/CIV :-) =======================================================================