php - Echo only the day number -


this code right now:

echo"<tr>         <td>{$row['game_release']}</td>     </tr>"; 

how echo day? example 2015-05-06 should echo '6'?

this code found on stackoverflow, couldn't work:

$string = "2010-11-24"; $date = datetime::createfromformat("y-m-d", $string); echo $date->format("d"); 

this should work you:

here create new datetime object, format format want.

echo"<tr>     <td>" . (new datetime($row['game_release']))->format("j") . "</td> </tr>"; 

Popular posts from this blog