Home > Backend Development > PHP Tutorial > Practical functions about time in php and mysql_PHP tutorial

Practical functions about time in php and mysql_PHP tutorial

WBOY
Release: 2016-07-13 10:37:18
Original
757 people have browsed it

//Get the date n days ago
function get_minday($n){
return date('Y-m-d',(time()-3600*24*($n-1)));

}


//Get the day of the date
$a="2014-01-22";
$a=strtotime($a); //Convert time to timestamp
echo date('d',$a);

//The first of next month
$reslut_date=date('Y-m-1',strtotime('+1 month',strtotime($row_date['date1'])));

//16th of the month
$reslut_date=date('Y-m-16',strtotime($row_date['date1']));


date_add(SaleDate, INTERVAL 8 HOUR) mysql, add 8 hours

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/735902.htmlTechArticle//Get the date n days ago function get_minday($n){ return date('Y-m-d', (time()-3600*24*($n-1))); } //Get the day of the date $a="2014-01-22"; $a=strtotime($a); //Convert the time to Timestamp ech...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template