fantic Posted October 21, 2008 Share Posted October 21, 2008 in my database the date format is YYYY-MM-DD i want do display this format like "Monday, October 20, 2008". what is the solution? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 21, 2008 Share Posted October 21, 2008 You need two functions. date() strtotime() strtotime() is used as the second argument in the date() function. Quote Link to comment Share on other sites More sharing options...
fantic Posted October 21, 2008 Author Share Posted October 21, 2008 i used date("r", strtotime($timestamp)); but it shows time also but i dont need time. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 21, 2008 Share Posted October 21, 2008 Look at the date() function in the manual. It gives you all the values you would need. $date = "2008-10-21"; echo date("l, F j, Y", strtotime($date)); //Will echo: Tuesday, October 21, 2008 Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 21, 2008 Share Posted October 21, 2008 The ideal way to do this is to covert it directly in the database. With MySQL you'd use SELECT DATE_FORMAT(`dateCol`, '%W, %M %e, %Y') FROM `table` 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.