Jump to content

Compare dates


tiota

Recommended Posts

MYSQL 5.1.36

PHP 5.3.0

 

This is following my recent  post about an hour ago, and thanks to PFMaBiSmAd for the reply...

 

This is my query along the with sample output

 

$qry = "Select employee.dept_num, department.dept_desc, timesheet.ts_timein, timesheet.ts_timeout,timesheet.ts_date

From timesheet, employee, department

Where timesheet.emp_num = employee.emp_num

AND department.dept_num = employee.dept_num

AND timesheet.ts_date BETWEEN '$start_date' AND '$end_date' ORDER BY ts_date";

 

 

output

 

+----------+----------------+-----------+------------+------------+

| dept_num | dept_desc      | ts_timein | ts_timeout | ts_date    |

+----------+----------------+-----------+------------+------------+

| E2502    | Accounts      | 04:16:00  | 16:18:00  | 2010-07-01 |

| E2502    | Accounts      | 08:06:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:04:00  | 16:16:00  | 2010-07-01 |

| E2502    | Accounts      | 08:06:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:47:00  | 19:13:00  | 2010-07-01 |

| E2502    | Accounts      | 09:11:00  | 05:53:00  | 2010-07-01 |

| E2502    | Accounts      | 08:05:00  | 00:00:00  | 2010-07-01 |

| D01      | IT Department  | 08:34:00  | 17:25:41  | 2010-07-01 |

| E2502    | Accounts      | 08:05:00  | 16:20:00  | 2010-07-01 |

| E2501    | Administration | 08:48:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:48:00  | 16:22:00  | 2010-07-01 |

| E2502    | Accounts      | 08:06:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:24:00  | 16:27:00  | 2010-07-01 |

| E2502    | Accounts      | 08:04:00  | 16:39:00  | 2010-07-01 |

| E2502    | Accounts      | 09:48:00  | 16:21:00  | 2010-07-01 |

| D01      | IT Department  | 08:08:00  | 16:30:05  | 2010-07-01 |

| E2502    | Accounts      | 08:54:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:04:00  | 16:17:00  | 2010-07-01 |

| E2502    | Accounts      | 09:08:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 04:19:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:05:00  | 16:20:00  | 2010-07-01 |

| E2502    | Accounts      | 08:06:00  | 16:18:00  | 2010-07-01 |

| E2502    | Accounts      | 08:04:00  | 16:21:00  | 2010-07-01 |

| E2501    | Administration | 08:07:00  | 17:05:00  | 2010-07-01 |

| E2501    | Administration | 08:48:00  | 16:27:00  | 2010-07-01 |

| E2502    | Accounts      | 04:19:00  | 00:00:00  | 2010-07-01 |

| E2502    | Accounts      | 08:15:00  | 16:19:00  | 2010-07-01 |

| E2501    | Administration | 08:54:00  | 00:00:00  | 2010-07-01 |

| D01      | IT Department  | 08:07:00  | 16:40:41  | 2010-07-01 |

| D01      | IT Department  | 09:50:00  | 17:53:40  | 2010-07-01 |

| E2501    | Administration | 09:19:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:17:00  | 16:14:00  | 2010-07-02 |

| E2502    | Accounts      | 08:11:00  | 00:00:00  | 2010-07-02 |

| D01      | IT Department  | 08:32:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:10:00  | 16:15:00  | 2010-07-02 |

| E2502    | Accounts      | 08:19:00  | 06:54:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:25:00  | 16:21:00  | 2010-07-02 |

| E2502    | Accounts      | 08:10:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 09:17:00  | 17:40:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 09:54:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:07:00  | 16:16:00  | 2010-07-02 |

| E2502    | Accounts      | 08:15:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 09:25:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:23:00  | 00:00:00  | 2010-07-02 |

| E2501    | Administration | 04:39:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:20:00  | 16:16:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:07:00  | 00:00:00  | 2010-07-02 |

| D01      | IT Department  | 08:08:00  | 17:30:05  | 2010-07-02 |

| D01      | IT Department  | 09:37:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:06:00  | 16:17:00  | 2010-07-02 |

| E2502    | Accounts      | 09:24:00  | 16:18:00  | 2010-07-02 |

| E2501    | Administration | 09:35:00  | 16:37:00  | 2010-07-02 |

| E2502    | Accounts      | 08:13:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 08:09:00  | 16:16:00  | 2010-07-02 |

| E2502    | Accounts      | 08:08:00  | 16:16:00  | 2010-07-02 |

| E2502    | Accounts      | 08:09:00  | 16:16:00  | 2010-07-02 |

| E2502    | Accounts      | 08:09:00  | 16:23:00  | 2010-07-02 |

| E2501    | Administration | 07:53:00  | 17:18:00  | 2010-07-02 |

| E2502    | Accounts      | 08:15:00  | 00:00:00  | 2010-07-02 |

| E2502    | Accounts      | 12:16:00  | 18:10:00  | 2010-07-03 |

| E2502    | Accounts      | 02:21:00  | 18:10:00  | 2010-07-03 |

| E2502    | Accounts      | 10:15:00  | 00:00:00  | 2010-07-03 |

| E2502    | Accounts      | 20:46:00  | 00:00:00  | 2010-07-04 |

| D01      | IT Department  | 07:09:00  | 00:00:00  | 2010-07-04 |

| E2502    | Accounts      | 17:14:00  | 00:00:00  | 2010-07-04 |

| E2502    | Accounts      | 07:11:00  | 19:13:00  | 2010-07-04 |

| E2502    | Accounts      | 08:11:00  | 17:10:00  | 2010-07-05 |

| E2502    | Accounts      | 07:58:00  | 16:18:00  | 2010-07-05 |

| E2502    | Accounts      | 08:15:00  | 00:00:00  | 2010-07-05 |

| D01      | IT Department  | 08:31:00  | 16:25:05  | 2010-07-05 |

| E2502    | Accounts      | 08:18:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:12:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:05:00  | 16:16:00  | 2010-07-05 |

| E2502    | Accounts      | 08:53:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:48:00  | 00:00:00  | 2010-07-05 |

| E2501    | Administration | 08:44:00  | 16:52:00  | 2010-07-05 |

| E2502    | Accounts      | 08:40:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 09:22:00  | 17:15:00  | 2010-07-05 |

| E2502    | Accounts      | 08:10:00  | 17:11:00  | 2010-07-05 |

| E2502    | Accounts      | 08:12:00  | 16:17:00  | 2010-07-05 |

| E2502    | Accounts      | 07:57:00  | 16:15:00  | 2010-07-05 |

| E2501    | Administration | 07:54:00  | 17:30:00  | 2010-07-05 |

| E2501    | Administration | 08:47:00  | 16:21:00  | 2010-07-05 |

| E2501    | Administration | 08:12:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:12:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:17:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:23:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:23:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:20:00  | 17:32:00  | 2010-07-05 |

| E2501    | Administration | 08:13:00  | 16:15:00  | 2010-07-05 |

| E2502    | Accounts      | 08:11:00  | 16:16:00  | 2010-07-05 |

| E2502    | Accounts      | 09:37:00  | 16:17:00  | 2010-07-05 |

| D01      | IT Department  | 08:36:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 10:20:00  | 20:08:00  | 2010-07-05 |

| D01      | IT Department  | 09:16:00  | 00:00:00  | 2010-07-05 |

| D01      | IT Department  | 10:34:00  | 20:16:00  | 2010-07-05 |

| E2501    | Administration | 08:23:00  | 16:19:00  | 2010-07-05 |

| E2502    | Accounts      | 07:57:00  | 17:31:00  | 2010-07-05 |

| E2502    | Accounts      | 07:57:00  | 16:15:00  | 2010-07-05 |

| E2502    | Accounts      | 08:06:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:12:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:36:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 09:19:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:27:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 09:29:00  | 00:00:00  | 2010-07-05 |

| E2502    | Accounts      | 08:16:00  | 06:12:00  | 2010-07-05 |

| E2501    | Administration | 09:55:00  | 16:19:00  | 2010-07-05 |

+----------+----------------+-----------+------------+------------+

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/208013-compare-dates/
Share on other sites

Edit: ^^^ I want to know the same thing.

 

You keep starting new threads for this problem. Why?

 

If you had continued with your very first thread on this problem, you could have probably solved this by now. When you don't continue a problem in the same thread, that just throws away the history of how you got to this point and people end up needing to ask you for details of what you are doing.

Link to comment
https://forums.phpfreaks.com/topic/208013-compare-dates/#findComment-1087376
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.