example-current-time-function | w3resource

MySQL CURRENT_TIME() function

In MySQL, the CURRENT_TIME() returns the current time in ‘HH:MM:SS’ format or HHMMSS.uuuuuu format depending on whether numeric or string is used in the function. CURRENT_TIME() and CURRENT_TIME are the synonym of CURTIME().

Note: All of the example codes of this page will produce outputs depending upon the current time.

Syntax Diagram:

MySQL CURRENT_TIME() Function - Syntax Diagram

MySQL Version: 5.6

Video Presentation:

Your browser does not support HTML5 video.

Pictorial Presentation:

Pictorial Presentation of MySQL CURRENT_TIME() function

Example-1: MySQL CURRENT_TIME

The following statement will return the current time in ‘HH:SS:MM’ format.

Sample Output:

mysql> SELECT CURRENT_TIME; +--------------+ | CURRENT_TIME | +--------------+ | 11:35:45 | +--------------+ 1 row in set (0.00 sec)
         
query('SELECT CURRENT_TIME') as $row) < echo ""; echo ""; echo ""; > ?>
Current time
" . $row['CURRENT_TIME'] . "
            Current time    %> catch (Exception ex) < out.println("Can’t connect to database."); >%>   

The following statement will return the current time in ‘HH:SS:MM’ format.

Sample Output:

mysql> SELECT CURRENT_TIME(); +----------------+ | CURRENT_TIME() | +----------------+ | 11:39:47 | +----------------+ 1 row in set (0.01 sec)
         
query('SELECT CURRENT_TIME()') as $row) < echo ""; echo ""; echo ""; > ?>
Current time
" . $row['CURRENT_TIME()'] . "

All Date and Time Functions :

Click here to see the MySQL Date and time functions.

Follow us on Facebook and Twitter for latest update.

Читайте также:  List file extensions java

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook

Источник

Оцените статью