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! Link to comment https://forums.phpfreaks.com/topic/175479-solved-how-to-display-a-different-date-format/ 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... Link to comment https://forums.phpfreaks.com/topic/175479-solved-how-to-display-a-different-date-format/#findComment-924662 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. Link to comment https://forums.phpfreaks.com/topic/175479-solved-how-to-display-a-different-date-format/#findComment-924698 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.