Home Tutorial Php Sql MySql Time Interval

 
 

MySql Time Interval
Posted on: December 9, 2010 at 12:00 AM
This example illustrates how to get date and time between specific time interval.

MySql Time Interval

This example illustrates how to get date and time between specific time interval.

In this example we create a query "select lastAccess from emp WHERE lastAccess BETWEEN '2008-09-01' AND '2008-12-01'" to find the data between specified interval. The BETWEEN and AND keyword are used for it.

 

Query
 
 select lastAccess from emp 
   WHERE lastAccess BETWEEN '2008-09-01' AND '2008-12-01';
Output
 
+---------------------+
| lastAccess          |
+---------------------+
| 2008-11-26 11:13:08 |
| 2008-10-01 13:17:45 |
| 2008-09-01 13:17:45 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
| 2008-11-26 11:13:08 |
+---------------------+

 

 

 

 

Related Tags for MySql Time Interval:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.