Friday, September 22, 2017

How to do required date format from mysql default date format (2017-09-22 into 22-09-2017)



Example:
               1). $this->db->select("date_format(substr(l.last_modified_on,1,10),'%d/%m/%Y') AS last_modified_on");
                    Output: 2017-09-22 12:12:12 into 22/09/2017

               2). SELECT DATE_FORMAT("2017-06-15", "%Y");
                 Output: 2017

                3). SELECT DATE_FORMAT("2017-06-15", "%W %M %e %Y");
                Output: Thursday June 15 2017

No comments:

Post a Comment