Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
A php/mysql project for school...
Results 1 to 10 of 10

Thread: A php/mysql project for school...

  1. #1

    A php/mysql project for school...

    i am doing a time management project for school to make keeping track of school and projects and the time spent on them easier..

    but what i have been unable to find, is how to add time up. Can somebody please help me?

  2. #2

    Re:A php/mysql project for school...

    What do you mean?
    This may not be what you're looking for, but you can store time (relative to the unix epoch, in seconds) using the time() function and then compare it later. You can use mktime() to make things user-readable
    http://www.php.net/manual/en/function.mktime.php

  3. #3

    Re:A php/mysql project for school...

    I'm sorry i worded it in a way that made it hard to describe it.

    The user of the application is going to input a time they started and a time they stopped, for recording how long they spent on it. I need to make MySQL find out how long they spent on it.

  4. #4

    Re:A php/mysql project for school...

    Okay, just have them input it in a format, store it as time - use strtotime(), then calculate the difference, and divide by 60 twice to get the hours spent on it.

  5. #5

    Re:A php/mysql project for school...

    it looks like that only works with comparing it to the current time.. the user will have to input both when they started and when they stopped.

  6. #6

    Re:A php/mysql project for school...

    Just store both...

  7. #7

    Re:A php/mysql project for school...

    this is what i found works
    Code:
    mysql> select time_to_sec(end) from timetest;          60780 
    
    mysql> select time_to_sec(start) from timetest;         52920 
    
    mysql> select 60780-52920;   7860
    
    mysql> select sec_to_time('7860'); 02:11:00
    note: start: 14:42:00 and end: 16:43:00

  8. #8

    Re:A php/mysql project for school...

    [quote author=Dusk_Knight link=board=9;threadid=9392;start=0#msg85149 date=1088116825]
    this is what i found works
    Code:
    mysql> select time_to_sec(end) from timetest;          60780 
    
    mysql> select time_to_sec(start) from timetest;         52920 
    
    mysql> select 60780-52920;   7860
    
    mysql> select sec_to_time('7860'); 02:11:00
    note: start: 14:42:00 and end: 16:43:00
    [/quote]

    Code:
    select sec_to_time(sum((time_to_sec(end) - time_to_sec(start)))) from timetest;
    That way you can have multiple rows and it adds all the rows.

  9. #9

    Re:A php/mysql project for school...

    Thanks gorn, that will make everything a whole lot easier.

  10. #10
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:A php/mysql project for school...

    I created a time management weblication for work. I have the code @ home. Send me a PM with your email addy and I'll glady send it to you this weekend if you want to deconstruct it.

Similar Threads

  1. Linux in the school and classroom
    By Anonymous in forum Linux - General Topics
    Replies: 3
    Last Post: 03-09-2008, 03:07 AM
  2. school class size
    By rwtoften in forum General Chat
    Replies: 7
    Last Post: 08-31-2004, 04:15 PM
  3. Old School games
    By ph34r in forum Linux - Software, Applications & Programming
    Replies: 8
    Last Post: 04-08-2004, 10:23 PM
  4. Petttion My School
    By Ashcrow in forum General Chat
    Replies: 10
    Last Post: 03-06-2002, 06:53 PM
  5. Yippi... school is out !!
    By in forum General Chat
    Replies: 15
    Last Post: 12-24-2001, 04:16 PM

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
  •