www.webdeveloper.com
Results 1 to 3 of 3

Thread: adding/subracting time

  1. #1
    Join Date
    Aug 2005
    Posts
    219

    adding/subracting time

    Hi,
    Please let me explain my question with real data:

    Time 1: 01:26:37
    Time 2: 03:42:12

    How can I add and subtract the two above?

  2. #2
    Join Date
    Apr 2003
    Posts
    127
    The answer to your question may be a bit complex.
    I have two links that help to explain the process of adding and subtracting time and well worth the read.

    time
    and
    date

    What is really interesting is that the "time()" function returns a value in seconds which began in 1970 and is called "Unix Epoch"

    Seconds can easily be added and subtracted using multiples of seconds, minutes, hours and days in seconds.

    The "date()" function can manipulate the time return to a readable format.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,921
    If the values are coming from a database query, you could use the DBMS's date/time arithmetic functions in the query, e.g. the SUBTIME() function in MySQL.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles