<?php header('Content-Type: text/html; charset=utf-8'); //PHP timestamp function to get the unix timestamp of the specified date echo strtotime('2018-1-19').PHP_EOL; echo time().PHP_EOL; //PHP timestamp function to get English text date and time echo date('Y-m-d H:i:s', 1516291200).PHP_EOL; echo date('Y-m-d H:i:s', time()).PHP_EOL; //print the timestamp of this time tomorrow echo date('Y-m-d H:i:s',strtotime('+1 day')).PHP_EOL; //print the timestamp of this time yesterday echo date('Y-m-d H:i:s',strtotime('-1 day')).PHP_EOL; //print the timestamp of this time next week echo date('Y-m-d H:i:s',strtotime('+1 week')).PHP_EOL; //print the timestamp of this time last week echo date('Y-m-d H:i:s',strtotime('-1 week')).PHP_EOL; //Print the timestamp specifying the next day of the week echo date('Y-m-d H:i:s',strtotime('next Thursday')).PHP_EOL; //Print the timestamp of the specified day of the week echo date('Y-m-d H:i:s',strtotime('last Thursday')).PHP_EOL; //Timestamp to get the year, month, day, hour, minute and second $datetimeArr = getdate(1516329995); $hours = $datetimeArr["hours"]; $minutes = $datetimeArr["minutes"]; $seconds = $datetimeArr["seconds"]; $month = $datetimeArr["mon"]; $day = $datetimeArr["mday"]; $year = $datetimeArr["year"]; echo "year:$year\nmonth:$month\nday:$day\nhour:$hours\nminutes:$minutes\nseconds:$seconds\n"; // Date time intercepts year month day $datetime = date('Y-m-d H:i:s', 151641111119); echo ((int)substr($datetime,0,4)).PHP_EOL;;//Get the year echo ((int)substr($datetime,5,2)).PHP_EOL;;//Get the month echo ((int)substr($datetime,8,2)).PHP_EOL;;//Get the date
Effect picture: