Jump to content

Using certain characters from a string.


smithmr8

Recommended Posts

explode

 

$time = '2009-04-18 05:55:30';
$time = explode("-", $time);
$month = $time[1];

echo $month;

 

One way to do it. But if you are just getting the data out for the specific purpose, you can use the MySQL Date functions and just pull the month out in the query instead of having to use PHP to parse the data.

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.