Jump to content

substring question


chasethemetal

Recommended Posts

So I have a database with a bunch of dates in it. In this format 05/15/2011. And this is how I get that out.

 

$data = mysql_query("SELECT * FROM location ORDER BY id ASC") or die(mysql_error());

 

while($info = mysql_fetch_array( $data )) {

 

  $date = $info['date'];

};

 

echo "$date";

 

The resulted echo would be 05/26/2011

 

How do I get $date to echo out JUST 05? I'm trying to isolate the month. I think the method is using substrings, but I havent had any luck.

 

Thanks any help would be great!

Link to comment
https://forums.phpfreaks.com/topic/237573-substring-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.