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 Link to comment https://forums.phpfreaks.com/topic/98388-parsing-question/ 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. Link to comment https://forums.phpfreaks.com/topic/98388-parsing-question/#findComment-503507 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? Link to comment https://forums.phpfreaks.com/topic/98388-parsing-question/#findComment-503523 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 Link to comment https://forums.phpfreaks.com/topic/98388-parsing-question/#findComment-503532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.