Usage Analysis of the strtotime function in PHP, phpstrtotime
This article describes the use of the time addition and subtraction function strtotime in PHP. We will share this with you for your reference. The details are as follows:
Time addition and subtraction
<? Php // obtain the year of local extraction + 1 $ date = date ("Y-m-d", mktime (, 0, date ("m "), date ("d"), date ("Y") + 1);?>
What should I do if I want to get the time in the database? A good function strtotime is found in the PHP document. You can add or subtract the time:
int strtotime ( string time [, int now] )
Return type int
Functions can be used for time conversion and addition/subtraction.
<? Php // date () format time returns the String type. // Add one year $ date_year = date ('Y-m-d', strtotime ("$ date + 1 year"); echo $ date_year; // Add one day $ date_tomorrow = date ('Y-m-d', strtotime ("+ 1 day"); echo $ date_tomorrow; // Add a week $ date_week = date ('Y-m-d', strtotime ("$ date + 1 week"); echo $ date_week;?>
PS: here we recommend several time and date related tools for your reference:
Online date/day calculator:
Http://tools.jb51.net/jisuanqi/date_jisuanqi
Online date calculator/days calculator:
Http://tools.jb51.net/jisuanqi/datecalc
Online date-days difference calculator:
Http://tools.jb51.net/jisuanqi/onlinedatejsq
Unix timestamp Conversion Tool:
Http://tools.jb51.net/code/unixtime