Issues Book

About Me

ASK CHOUDHARY
View my complete profile

Monday, June 2, 2014

MySQL - Select only Date/ Time from a 'DateTime' Column

SELECT DATE_FORMAT(NOW(), '%Y-%m-%d') DATEONLY,
       DATE_FORMAT(NOW(),'%H:%i:%s') TIMEONLY

OR


select date(ColumnName) from tablename


select time(ColumnName) from tablename
Posted by ASK CHOUDHARY at 5:55 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

MySQL - Update only Time of a 'DateTime' column

UPDATE `table` SET `date_column` = CONCAT(DATE(`date_column`), ' 23:59:59') 
Posted by ASK CHOUDHARY at 5:52 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Index

  • ►  2015 (1)
    • ►  July (1)
      • ►  Jul 14 (1)
  • ▼  2014 (9)
    • ▼  June (7)
      • ►  Jun 30 (1)
      • ►  Jun 23 (1)
      • ►  Jun 19 (1)
      • ►  Jun 16 (1)
      • ►  Jun 13 (1)
      • ▼  Jun 02 (2)
        • MySQL - Select only Date/ Time from a 'DateTime' C...
        • MySQL - Update only Time of a 'DateTime' column
    • ►  May (2)
      • ►  May 28 (1)
      • ►  May 27 (1)
Ethereal theme. Theme images by enjoynz. Powered by Blogger.