vcodeinfote Posted July 25, 2008 Share Posted July 25, 2008 Hello, Can anyone help me!!! 2008-07-06 16:46:15 2008-07-06 16:47:44 2008-07-06 10:18:25 2008-07-24 14:38:25 If these are the records in a table i need to get the output like this: 2008-07-06 2008-07-24 Please help Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 25, 2008 Share Posted July 25, 2008 you can use date function. like this: $date=date('m-d-Y',strtotime($row['date'])); echo $date; $row['date'] is fetching from table. Quote Link to comment Share on other sites More sharing options...
abhikerl Posted July 25, 2008 Share Posted July 25, 2008 visit http://www.php.net/date. You will get good example. This helped me out too when I was dealing with date on a project. Quote Link to comment Share on other sites More sharing options...
samshel Posted July 25, 2008 Share Posted July 25, 2008 Check this out. http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_date-format Quote Link to comment Share on other sites More sharing options...
waynew Posted July 25, 2008 Share Posted July 25, 2008 $result = mysql_query("SELECT DAY(example_date), MONTH(example_date), YEAR(example_date) FROM example_table WHERE example_id = $id"); while($row = mysql_fetch_assoc($result)){ $day = $row['DAY(example_date)']; $month = $row['MONTH(example_date)']; $year = $row['YEAR(eample_date)']; } Not the best example but it does contribute. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 26, 2008 Share Posted July 26, 2008 To get a list of distinct dates from a DATETIME column - SELECT DISTINCT DATE(your_datetime_column) FROM your_table ORDER BY your_datetime_column Quote Link to comment Share on other sites More sharing options...
rawb Posted July 26, 2008 Share Posted July 26, 2008 Hello, Can anyone help me!!! 2008-07-06 16:46:15 2008-07-06 16:47:44 2008-07-06 10:18:25 2008-07-24 14:38:25 If these are the records in a table i need to get the output like this: 2008-07-06 2008-07-24 Please help If you're using PHP to display the result check out substr - http://www.php.net/substr echo substr($date, 0, 10); will turn '2008-07-06 16:46:15' to '2008-07-06' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.