how to convert time from (yyyy-mm-dd hh:mm:ss) this format to simply (hh:mm:ss) ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    how to convert time from (yyyy-mm-dd hh:mm:ss) this format to simply (hh:mm:ss) ?

    i have stored the user break times in the database...

    user break start time and end time...

    the timestamp stored in the database in the (yyyy-mm-dd hh:mm:ss) format in the database...

    when i retrieve the time from the database the time will be like this...
    2010-10-26 10:00:39

    but i want only the time part. i.e 10:00:39
    i dont want the date..

    how to get only the time from the database? plz help?
  • sirchill

    #2
    try..

    SELECT TIME(timefield) AS time FROM table WHERE somethingsometh ing

    Comment

    • kovik
      Recognized Expert Top Contributor
      • Jun 2007
      • 1044

      #3
      Or, since you're asking in the PHP forum:
      Code:
      echo date('H:i:s', strtotime($mysql_date));

      Comment

      Working...