Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. +-------------------------------------------------------------------------------+
  2. | id | name | start_time | end_time | description | break |
  3. |-------------------------------------------------------------------------------|
  4. | 101 | Shift1 | 01:03:55 | 06:00:55 | Shift 1 | 1 |
  5. |-------------------------------------------------------------------------------|
  6. | 102 | Shift2 | 06:03:55 | 01:00:55 | Shift 2 | 3 |
  7. +-------------------------------------------------------------------------------+
  8.  
  9. $shift_time = mysql_query("select start_time, end_time from rpt_shift_def where name ='Shif1'")or die(mysql_error());
  10. while ($row = mysql_fetch_assoc($shift_time))
  11. {
  12. $Total_shift_time = strtotime($row['end_time']) - strtotime($row['start_time']);
  13. $hours=floor($Total_shift_time/3600);
  14. $Total_shift_time-=$hours*3600;
  15. $minutes=floor($Total_shift_time/60);
  16. $Total_shift_time-=$minutes*60;
  17. $seconds=$Total_shift_time;
  18. $Total_shift_time=$hours.":".$minutes.":".$seconds;*/
  19. echo "$Total_shift_time";
  20. echo "</br>";
  21. }
  22.  
  23. 4:57:0
  24.  
  25. 18:57:0
  26.  
  27. -6:57:0
  28.  
  29. if( $Total_shift_time < 0 ) {
  30. $Total_shift_time += 86400; // Number of seconds in a day
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement