Mysql Date and Time

The Tutorial illustrate an example, that help in understanding datetime. In this Tutorial ,we illustrate an example that help you in writing a date time format Query in different ways.

Ads

Mysql Date and Time

     

The Tutorial illustrate an example, that help in understanding datetime. In this Tutorial ,we illustrate an example that help you in writing a date time format Query in different ways.

now ( )  :The below Query return you the current date in yyyy-mm-dd and time in hh:mm:ss.

Query for displaying current date and time:-

 

 

 

 

 

mysql> select now()as DateandTime;

Output:-

+---------------------+
| DateandTime |
+---------------------+
| 2008-12-20 12:19:07 |
+---------------------+
1 row in set (0.00 sec)

Query for extracting date from datetime:-

The given below Query return you the current date.

mysql> select day(now())as TodayDate;

Output:-

+-----------+
| TodayDate |
+-----------+
| 20 |
+-----------+
1 row in set (0.00 sec)

Advertisements

Ads
Share on Google+Share on Google+

Mysql Date and Time

Posted on: December 31, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Mysql Date and Time  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads