Jump to content

PArsing date??


jwwceo

Recommended Posts

You can use strtotime() in conjunction with the date() function, or you can just explode the string on "-" and assign the the exploded segments to variables.

<?php
$date = '2007-12-16';
list($year,$month,$day)  = explode('-',$date);
echo 'Year: ' . $year . "<br>\n";
echo 'Month: ' . $month . "<br>\n";
echo 'Day: ' . $day . "<br>\n";
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/81979-parsing-date/#findComment-416553
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.