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


 
 

Share on Google+Share on Google+

Sql Date and Time Format

Advertisement
The Tutorial illustrate an example from the 'Sql Date and Time Format'. To understand this example we use the following syntax that is used to format date and time.

Sql Date and Time Format

     

The Tutorial illustrate an example from the 'Sql Date and Time Format'. To understand this example we use the following syntax that  is used to  format date and time.

 SYNTAX:- DATE_FORMAT(date,format)

date:-This is the field in  which we have specified date and time.

format:-The format specifier used here are

%W:-   This is used for showing weekday name i.e(Sunday-Saturday).
%e:-   This is used for showing Day of the month, numeric (0-31).
%M :-  This is used for showing Month name (January-December)
%Y:-  This is used for showing Year, numeric, four digits
%r :-  This is used for showing Time, 12-hour (hh:mm:ss followed by AM or PM)

Query:-

The given below Date_Format(date,format) Query return you the format date in the order of Week,Day,Month,Year and time.

SELECT DATE_FORMAT('2008-12-15 15:53:00','%W %e %M %Y %r');

Output:-

Advertisement

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

Ask Questions?    Discuss: Sql Date and Time Format   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Lawanda
December 13, 2011
adASzAKcPVGl

When you think about it, that's got to be the right asnewr.
DMCA.com