DATE_FORMAT, STR_TO_DATE


-- datetime, date to str

SELECT DATE_FORMAT(REG_DATE, '%Y-%m-%d %H:%i:%s') FROM TB_FILE;

SELECT DATE_FORMAT(REG_DATE, '%Y-%m-%d %H:%i:%s') FROM TB_FILE;

-- str to datetime

select STR_TO_DATE('2011-04-30 15:13:25', '%Y-%m-%d %H:%i:%s');

--

SELECT NOW();

SELECT DATE_ADD(NOW(), INTERVAL -1 DAY);

Comments

Popular posts from this blog

Project euler 169 found clue

Floyd-Warshall's algorithm