Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Time Function 
 

Mysql Time Function is used to find the current time in hour, minute and second etc.

 

Mysql Time Function

                         

Mysql Time Function is used to find the current time in hour, minute and  second etc.

Understand with Example

The Tutorial illustrate an example from 'Mysql Time Function'. To understand and grasp this example we show you the list of queries that return you the different current date, current time, From Unix Time in hour, minute and second. 

Query to select Current Time  use "CURRENT_TIME()" function:

 

 

The Query below is used to return the current time of a table in database.

 mysql> SELECT CURRENT_TIME();
+----------------+
| CURRENT_TIME() |
+----------------+
| 16:26:19 |
+----------------+
1 row in set (0.00 sec)

Query to Converts a Unix timestamp into a date use "FROM_UNIXTIME(1064431682)":

mysql> SELECT FROM_UNIXTIME(1064431682);
+---------------------------+
| FROM_UNIXTIME(1064431682) |
+---------------------------+
| 2003-09-25 00:58:02 |
+---------------------------+
1 row in set (0.00 sec)

Query to converts the Time into Hour:

The Query to returns a numeric between (0-23) for the hour of the specified time using "HOUR(time)"

mysql> SELECT HOUR('02:02:14');
+------------------+
| HOUR('02:02:14') |
+------------------+
| 2 |
+------------------+
1 row in set (0.00 sec)

Query to converts the Time into Minute:

The Query is useful to returns a numeric between  (0-59) for the minute of the specified time using "MINUTE(time)"

mysql> SELECT MINUTE('02:02:14');
+--------------------+
| MINUTE('02:02:14') |
+--------------------+
| 2 |
+--------------------+
1 row in set (0.00 sec)

Query to converts the seconds to a time using SEC_TO_TIME(seconds):

The Query will help you to return the time by converting the seconds using SEC_TO_TIME ( ) query.

mysql> SELECT SEC_TO_TIME(12345);
+--------------------+
| SEC_TO_TIME(12345) |
+--------------------+
| 03:25:45 |
+--------------------+
1 row in set (0.00 sec)

                         

» View all related tutorials
Related Tags: sql mysql c table date value return max tab row rows record maximum records ws e ax im from m

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.