Home Sql Sqldate Sql Date and Time Functions
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Sql Date and Time Functions

Advertisement
The Tutorial illustrate a function to extract the day of week, name of month, name of day, day of year, number of week.

Sql Date and Time Functions

     

The Tutorial illustrate a function to extract the day of week, name of month, name of day, day of year, number of week.

Understand with Example

The section of this tutorial illustrate an example from 'Sql Date and Time Functions'.

Query (DAYOFWEEK) :-Here is the query for extracting the day of week. This function returns a numeric value ranging from(1-7).

 

 

 

 

 

SELECT DAYOFWEEK(CURRENT_TIMESTAMP);

Output:-

Query (MONTHNAME) :-Here is the query for extracting the Name of Month. This function returns a name of the month ranging from (January-December). 

SELECT MONTHNAME('2008-12-15');

Output:-

Query (DAYNAME) :-Here is the query for extracting the Name of the day. This function returns the name of the day ranging from (Sunday-Saturday).  

SELECT DAYNAME('2008-12-15');

Output:-

Query (DAYOFYEAR):-Here is the query for extracting the day of year. This function returns the day of the year ranging from (1-365).  

SELECT DAYOFYEAR('2008-12-15');

Output:-

Query (WEEK) :-Here is the query for extracting the number of week. This function returns the number of the week ranging from (1-53).

SELECT WEEK('2008-12-15');

Output:-

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 31, 2008

Related Tutorials

Ask Questions?    Discuss: Sql Date and Time Functions  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com