turpentyne Posted March 2, 2012 Share Posted March 2, 2012 Does anybody know how to take the queried standard date format - 2012-04-02 for example - and print it to the page as April 2, 2012? Or at the very least, to switch to 04-02-2012? Trying to find some tutorials online. Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/ Share on other sites More sharing options...
timmah1 Posted March 2, 2012 Share Posted March 2, 2012 http://php.net/manual/en/function.date.php Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322960 Share on other sites More sharing options...
timmah1 Posted March 2, 2012 Share Posted March 2, 2012 $date = date('F j, Y'); echo $date; Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322961 Share on other sites More sharing options...
turpentyne Posted March 2, 2012 Author Share Posted March 2, 2012 hmmm... not today's date? I'm trying to convert $table_row['workshop_date'] which is 2012-12-02 into a date. I'll have to look through that first link, and see if I can understand Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322963 Share on other sites More sharing options...
PFMaBiSmAd Posted March 2, 2012 Share Posted March 2, 2012 Use the mysql DATE_FORMAT() function in your query to format your date (or datetime or time) column any way you want when you select it - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322964 Share on other sites More sharing options...
timmah1 Posted March 2, 2012 Share Posted March 2, 2012 I always use this when pulling the date from the db $date = date('F j, Y', strtotime($table_row['workshop_date'])); Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322966 Share on other sites More sharing options...
Pikachu2000 Posted March 2, 2012 Share Posted March 2, 2012 Use the mysql DATE_FORMAT() function in your query to format your date (or datetime or time) column any way you want when you select it - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format +1 Quote Link to comment https://forums.phpfreaks.com/topic/258085-mysql-date-to-normal-date/#findComment-1322981 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.