Tuesday, October 13, 2015

Date Format in MySQL

Hi All,
I have column "RFB_DATE" with value 2015-09-01 00:00:00.0 now I want to remove " 00:00:00.0 " part from the date.

here is the syntax to do so-

SELECT  DATE_FORMAT(RFB_DATE,'%Y-%m-%d') RFB_DATE  FROM TBL;

Alternatively we can also do below-

SELECT   SUBSTR(RFB_DATE,1,11) FROM TBL;

Output: 2015-09-01.

No comments:

Post a Comment