Jump to content
Larry Ullman's Book Forums

Recommended Posts

There are a number of approaches you can take.

 

$date is a string - so you could use substr
 

$date = '15-09-2010';
$year = substr($date,-4);

 

or since the date is formatted with dashes - you could use explode

$date = '15-09-2010';
$date_parts = explode('-', $date);
$year = $date_parts[2];

 

  • Upvote 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...