You could use the function: "strtotime()",as your question ,the example like $youwantvalue=strtotime("now - 100 days 4 hours 22 minutes "); print(date($yourwantvalue)); lucky for U!~
You could use the function: "strtotime()",as your question ,the example like $youwantvalue=strtotime("now - 100 days 4 hours 22 minutes "); print(date($yourwantvalue)); lucky for U!~
$youwantvalue=strtotime("now - 100 days 4 hours 22 minutes ");
print(date($yourwantvalue));
lucky for U!~
keaizhong(可爱钟) 的:
function reday($d,$hour,$min, $sec,$mon,$day,$year){
return date("Y-m-d", mktime($hour,$min, $sec,$mon,$day,$year)-60*60*24*$d);
}
You could use the function: "strtotime()",as your question ,the example like
$youwantvalue=strtotime("now - 100 days 4 hours 22 minutes ");
print(date($yourwantvalue));
lucky for U!~
COOL!!!推荐用这种
function get_new_time($year,$mon,$day,$hour,$min, $sec,$flag="before"){
$year=empty($year) ? "" : "$year years";
$mon=empty($mon) ? "" : "$mon months";
$day=empty($day) ? "" : "$day days";
$hour=empty($hour) ? "" : "$hour hours";
$min=empty($min) ? "" : "$min minutes";
$sec=empty($sec) ? "" : "$sec seconds";
$flag=($flag!="before") ? "+" : "-";
echo "now $flag $year $mon $day $hour $min $sec<br>";
return strtotime("now $flag$year $flag$mon $flag$day $flag$hour $flag$min $flag$sec");
}
//得到$year年,$mon月,$day日,$hour小时,$min分,$sec秒前(后)的unix时间戳
function get_new_time($year,$mon,$day,$hour,$min, $sec,$flag="before"){
$year=empty($year) ? "" : "$year years";
$mon=empty($mon) ? "" : "$mon months";
$day=empty($day) ? "" : "$day days";
$hour=empty($hour) ? "" : "$hour hours";
$min=empty($min) ? "" : "$min minutes";
$sec=empty($sec) ? "" : "$sec seconds";
$flag=($flag!="before") ? "+" : "-"; return strtotime("now $flag$year $flag$mon $flag$day $flag$hour $flag$min $flag$sec");
}