phpretard Posted March 28, 2008 Share Posted March 28, 2008 My DB holds the date like this - 20080115. How can I turn that into - January 15, 2008 - ? $U is the date. My Query Code: $result = mysql_query("SELECT * FROM list"); while($row = mysql_fetch_array($result)) { include 'vars.php'; echo $U ."<br>"; } Any Help? -Anthony Quote Link to comment Share on other sites More sharing options...
bpops Posted March 28, 2008 Share Posted March 28, 2008 You could see if strtotime() might work. I don't know if it will handle that string specifically, but you could always break it up with dashes before giving it to the function. Then use date() to turn it into what you want. Quote Link to comment Share on other sites More sharing options...
phpretard Posted March 28, 2008 Author Share Posted March 28, 2008 I don't know how to use - strtotime() - Can you give an example please? Quote Link to comment Share on other sites More sharing options...
asaschool Posted March 28, 2008 Share Posted March 28, 2008 Here is a varation of something I use: echo date("M. jS Y", strtotime($dateYouAreManipulating['date'])); This will display something like: Jan. 23rd 2008 Look at http://us.php.net/manual/en/function.date.php for the options to this Hope this helps 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.