Tuesday 26 June 2012

Format Date Time using MySQL Query

// The Below Query will select all the users date in (20-06-2012 17:25:36) format while search the list of users records which are created (date_created) in the current month only.

SELECT DATE_FORMAT(date_created, '%d-%m-%Y %H:%i:%s') as initial_date
FROM users 
WHERE (SELECT MONTH(date_created)) = ( SELECT MONTH( NOW() ) ) 

No comments:

Post a Comment

Please post any queries and comments here.