我得到了年日(1-366),我需要弄清楚它在哪个月,我该怎么做?好吧,我实际上有一个日期字符串,例如:年,日或年,一天中的分钟,秒,我最终想从中创建一个 POSIX 时间戳,我该怎么做?
谢谢!
If you have PHP >= 5.3, then you can use DateTime::createFromFormat
.
$day = 176;
$date = DateTime::createFromFormat('z', $day);
echo $date->getTimestamp(); // 1372275280
<?php
$year=2013;
$d=360;
echo date("m",strtotime("1/1/$year + $d days"))
?>
Use the date function to get a posix time stamp.
To get the month of a certain date, use intval(date('m'), mktime($h,$m,$s,$month,$day,$year))