fluvly Posted September 25, 2009 Share Posted September 25, 2009 I have this date and time inside a variable, taken from a database: $datetime = "2009-09-17 12:20:08"; I would like to extract just the date (without the time) and show it as "17/09/2009" instead. Is there a way to do this without the "explode" function? Thanks to anyone willing to help! Quote Link to comment Share on other sites More sharing options...
ILMV Posted September 25, 2009 Share Posted September 25, 2009 echo(date('d/m/Y',strtotime($datetime))); That should do it... Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 25, 2009 Share Posted September 25, 2009 To expand on ILMVs answer, take a look at the date function, and you can see all the different formats that can be applied. Simply for future reference of course. 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.