+ Reply to Thread
Results 1 to 10 of 10

add and subtract time

  1. #1
    Forum Contributor
    Join Date
    03-24-2007
    Posts
    107

    add and subtract time

    How do I add and subtract hours minutes and seconds?

    I’m writing a program to find when the sun is directly overhead. I’m doing this so that I can find the true north/south line. In the example on my program, at the town of Farmington, a plumb bob will cast a shadow on the north/south line at 11:51:39 on June 16

    Can somebody help me with the holes in my program? I’m almost there
    (EoT sheet 2)
    Attached Files Attached Files
    Last edited by rookie37; 06-06-2009 at 03:47 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: add and subtract time

    Hi,
    lots of info can be find at this site or this one

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: add and subtract time

    Not entirely clear to me where you want the calculation... perhaps you want:

    ="12:00"+((B33-C12)/86400)

    Above based on your expected output of 11:51:39

    Time in XL is Decimal - ie Noon is 0.5 ... in your example B33 & C12 are Seconds but stored as Integers - to convert to true XL Time equivalent we divide the value by 86400 (24*60*60).
    Last edited by DonkeyOte; 06-01-2009 at 03:17 AM.

  4. #4
    Forum Contributor
    Join Date
    03-24-2007
    Posts
    107

    add and subtract time

    How do I add and subtract time?

    I'm writing a program so that I can find the true north/south line. (not magnetic)

    On sheet 2 of my program I have;

    The town of Farmington is on Eastern Standard time. The standard meridian is 75 deg
    Farmington is 72 deg 49 min or 2 deg 11 min difference in location. The sun will be directly overhead in Farmington 8 min 44 seconds sooner than it will be over the standard meridian. (or 4 minutes of time for each degree) On jun 16 the sun will be 23 seconds slow

    The formula is S.T. = 12:00:00 - 8 min 44 sec + 23 sec
    S.T. = 11:51:39

    At that time a plumb bob will cast a shadow on the true north/south line
    Attached Files Attached Files

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: add and subtract time

    You'd make your life a lot simpler if you kept lat/lon in decimal degrees:

    ="12:00" + ( 4 * ( lon - refLon) - (C7 + D7/60) ) / 1440
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor
    Join Date
    03-24-2007
    Posts
    107

    Re: add and subtract time

    shg

    I know very little about excel. I don't know how to put in the formula you gave me

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: add and subtract time

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules.

    Normally this thread would now be closed, however, on this occasion given shg has provided an alternative approach I will merge the two threads.

    In short don't post dupes - bump the original if you don't have the required solution and explain what does not work and why.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: add and subtract time

    I second DO's request.

    If the EoT calculates time as standard Excel dates (whole numbers = days since 00 Jan 1900, fractions = time), you can simplify as
    Please Login or Register  to view this content.
    The only inconvenient part is that Excel won't display negative times as, for example, -0:00:23, so you have to show it in decimal format as above.
    Last edited by shg; 06-02-2009 at 08:09 AM.

  9. #9
    Forum Contributor
    Join Date
    03-24-2007
    Posts
    107

    Re: add and subtract time

    Quote Originally Posted by DonkeyOte View Post
    This is a duplicate post and as such does not comply with Rule 5 of our forum rules.

    Normally this thread would now be closed, however, on this occasion given shg has provided an alternative approach I will merge the two threads.

    In short don't post dupes - bump the original if you don't have the required solution and explain what does not work and why.
    I didn't mean to duplicate. When I put in the first post, I couldn't find it. I thought it didn't go through. This is why I put it in again

  10. #10
    Forum Contributor
    Join Date
    03-24-2007
    Posts
    107

    Re: add and subtract time

    Thank you all for your help. I solved it. (probably very unorthodox way by programming standards)

    I kept the time in number format. I then separated them

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1