squiblo Posted November 16, 2009 Share Posted November 16, 2009 my date is held in the variable "$date" and when echoed it shows 2009-11-16 in the format type of Y-mm-dd how can i change it to "dd-mm-Y"? Link to comment https://forums.phpfreaks.com/topic/181744-formatting-date-from-mysql-db/ Share on other sites More sharing options...
premiso Posted November 16, 2009 Share Posted November 16, 2009 You should look into strtotime and date. Alternatively, if you know the format is always the same, you can just use explode to re-construct the string. EDIT: Well I just read the title, if you are pulling it from a MySQL DB, look into MySQL Date and Time Functions as you can pull it out how you want it in the query instead of using up PHP's processing time to do it for you. Link to comment https://forums.phpfreaks.com/topic/181744-formatting-date-from-mysql-db/#findComment-958556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.