Home Sql Sqldate Sql Date and Time Functions



Sql Date and Time Functions
Posted on: December 31, 2008 at 12:00 AM
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:-

Related Tags for Sql Date and Time Functions:
cfunctionfuniotutorialtracnumberextractnameriaunctoearexteilmonthmnttrweekfuncmeratedaytoryearseeatracklleaaractstrxttutorssrithstono


More Tutorials from this section

Ask Questions?    Discuss: Sql Date and Time Functions  

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.