SQL MINUTE() Function


The SQL MINUTE() is a function, and return or extract the minute portion of a given input time value.

The SQL MINUTE() function returns a integer number specifying a whole number between 0 and 59, inclusive, representing the minute of the MINUTEs.

The SQL MINUTE() function is supports only datetime or timestamp based table columns or fields.

It can be used in SELECT statement as well in where clause.


Search Keys

    The remote server returned an error: (404) Not Found.

Related Links

    The remote server returned an error: (404) Not Found.

SQL MINUTE() Syntax

The below syntax is used to get minute of the MINUTE value (a integer number between 0 to 59, inclusive) from a given input datetime value.

For SQL SERVER / MY SQL / MS ACCESS


SELECT MINUTE('valid_datetime_value' or 'valid_timestamp_value');


SQL MINUTE() Example - Using Expression Or Formula

The following SQL SELECT statement will extract the minute of the MINUTE value from a given input datetime value. We use now() function to get the input date value.


SELECT 
NOW() AS 'Current Date and Time', 
MINUTE(NOW()) AS 'Minute Value';

The result of above query is:

Current Date and Time Minute Value
24-08-2012 19:37:30 37

Sample Database Table - BookOrder

BookID BookName OrderDate Qty DeliveryDate
1 Sql Server Interview Questions 12-09-2002 10:05:57 1 22-10-2002 19:04:13
2 SQL Success - Database Programming Proficiency 24-06-2002 19:29:31 10 27-07-2002 12:59:27
3 Troubleshooting SQL Server 17-08-1997 15:38:06 6 19-08-1997 22:59:39
4 Red Gate Guide to SQL Server 26-01-2010 11:34:30 9 28-02-2010 23:57:35
5 SQL Weaknesses on Database Processing 13-09-1996 12:23:11 6 24-09-1996 03:44:47
6 SQL Server: The Complete Reference 18-09-2003 21:03:34 16 22-10-2003 21:07:59
7 Programming Microsoft sql Server 2012 17-10-2006 04:41:01 6 19-11-2006 07:16:42
8 SQL Design Patterns 24-06-2000 20:42:19 16 28-06-2000 21:01:12
9 Begining Spatial With Sql Server 2008 16-06-2005 07:12:50 6 20-07-2005 02:47:47
10 Head First SQL 26-10-2005 19:52:29 9 28-10-2005 10:40:35
11 SQL Functions Reference 23-06-1998 16:48:27 15 26-07-1998 02:51:06
12 Database Systems Using Oracle 22-04-2008 21:31:27 19 24-04-2008 03:43:25

SQL MINUTE() Example - With Table Column

The following SQL SELECT statement display the column "OrderDate" and "DeliveryDate" from the "BookOrder" table. The MINUTE() function will extract the MINUTE value(a whole integer number from 1 to 60) from the column "OrderDate" and we will stored that value to a new column called "Order MINUTE" and "Delivery MINUTE".


SELECT 
OrderDate, MINUTE(OrderDate) As 'Order MINUTE', 
DeliveryDate, MINUTE(DeliveryDate) As 'Delivery MINUTE' 
FROM BookOrder;

The result of above query is:

OrderDate Order MINUTE DeliveryDate Delivery MINUTE
12-09-2002 10:05:57 5 22-10-2002 19:04:13 4
24-06-2002 19:29:31 29 27-07-2002 12:59:27 59
17-08-1997 15:38:06 38 19-08-1997 22:59:39 59
26-01-2010 11:34:30 34 28-02-2010 23:57:35 57
13-09-1996 12:23:11 23 24-09-1996 03:44:47 44
18-09-2003 21:03:34 3 22-10-2003 21:07:59 7
17-10-2006 04:41:01 41 19-11-2006 07:16:42 16
24-06-2000 20:42:19 42 28-06-2000 21:01:12 1
16-06-2005 07:12:50 12 20-07-2005 02:47:47 47
26-10-2005 19:52:29 52 28-10-2005 10:40:35 40
23-06-1998 16:48:27 48 26-07-1998 02:51:06 51
22-04-2008 21:31:27 31 24-04-2008 03:43:25 43

Search Keys

    The remote server returned an error: (404) Not Found.

Related Links

    The remote server returned an error: (404) Not Found.