开发者

Separated by years, months, days of the date

开发者 https://www.devze.com 2023-03-21 17:22 出处:网络
how can separate year, month, day in date. a开发者_开发百科nd each put in variable? 1390/02/05 $year = \'1390\';

how can separate year, month, day in date. a开发者_开发百科nd each put in variable?

1390/02/05
$year = '1390';
$month = '02';
$day = '05';

With respect


Something like:

list($year, $month, $day) = explode('/', '1390/02/05', 3);


$timestamp = strtotime('1390/02/05');
$year = date('Y', $timestamp);
$month = date('m', $timestamp);
$day = date('d', $timestamp);


you could do:

$date = '1390/02/05';
$array = $explode('/', $date);

$year = $array[0];
$month = $array[1];
$day = $array[2];


list($year, $month, $day) = explode('/', '1390/02/09', 3);
0

精彩评论

暂无评论...
验证码 换一张
取 消