Hi
MySQL contains a Table with field name as Start time which is of Data Type DATETIME the Data stored in that is like 2007-01-30 14:06:00
now i want to display only Date from Date Time that is i want to display 2007-01-30 only how do i do that please help me
DATETIME Function
Moderator: General Moderators
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
DATE_FORMAT() if possible within the MySQL query, otherwise you can extract the format using PHP after the query results are accessible.
Code: Select all
$datetime = "2007-01-30 14:06:00";
$myDate = substr($datetime, 0, 10); // 2007-01-30 (sub-string of length 10 characters from position 0)
echo $myDate;- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
MySQL DATE() function, if your mysql version supports it.