Formatting dates in mysql

Sun Jul 22, 2012 12:38 pm

Using date_format in mysql function you can change the date format for dates data selected from database. For example imagine that you have a table “Department” and you want to change date format for one of selected field:


SELECT date_format 
EntryDate'%m/%d/%Y %T' ) as entryDate FROM Department

Here Department is the table name and EntryDate is the field name. The formatting is done like this 'm/%d/%Y %T’ is used. You can change the date formats to many ones here is some of them:
'%W %D %M %Y %T'   Wednesday 4th June 2011 11:46:51
'%a %b %e %Y %H:%i'   Wed June 4 2011 11:46
'%m/%d/%Y %T'   06/04/2011 11:46:51
'%d/%m/%Y'   04/06/2011

  Related Posts  to : Formatting dates in mysql
 formatting string in c++     -  
 date formatting in Java     -  
 Comparing Dates in Java     -  
 find the difference between dates in     -  
 Get Difference in days between two dates as a number     -  
 Formatting a Date with date()     -  
 need help in mysql     -  
 need help in jdbc with mysql     -  
 connect to MYSQL from ASP     -