A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/sql/curtime-function-in-mysql/ below:

CURTIME() function in MySQL - GeeksforGeeks

CURTIME() function in MySQL

Last Updated : 23 Jul, 2025

CURTIME() function in MySQL is used to check the current time. It returns the current time as a value in ‘hh:mm:ss’ or 'hhmmss' format, depending on whether the function is used in a string or numeric context.

Syntax :

CURTIME(fsp)

Parameters :

This method accepts only one parameter.

fsp -

It specifies the returned fractional seconds precision. If the user omits the precision argument, the result will exclude precision.

Returns : 

It returns the current time.

Example-1:

Getting the current time using CURTIME Function.

SELECT CURTIME() as Curr_time ;

Output :

Example 2:

Getting the current time using CURTIME Function with precision is set to 3.

SELECT CURTIME(3) as Curr_time ;

Output :

Example-3:

Getting the current time using CURTIME Function in numeric format.

SELECT CURTIME() + 0  as Curr_time ;

Output :

Example-4:

The CURTIME function can be used to set the value of columns. To demonstrate create a table named DeliveryDetails.

CREATE TABLE DeliveryDetails (
DeliveryId INT AUTO_INCREMENT,
ProductId INT NOT NULL,
ProductName VARCHAR(20) NOT NULL,
Delivered_At TIME NOT NULL,
Delivered_On DATE NOT NULL,
PRIMARY KEY(DeliveryId)
);

Here, we will use CURDATE and CURTIME function when a delivery will be completed. The value in the Delivered_At column will be the value given by CURTIME and the value in the Delivered_On column will be the value given by the CURDATE Function.

INSERT INTO  
DeliveryDetails(ProductId, ProductName, Delivered_At, Delivered_On)
VALUES
(12345, 'Dell Latitude', CURTIME(), CURDATE() );

Now, checking the DeliveryDetails table :

SELECT * FROM DeliveryDetails;

Output :

DELIVERYID  PRODUCTID  PRODUCTNAME  DELIVERED_AT  DELIVERED_ON 1 12345 Dell Latitude  13:17:22 2020-11-20

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4