Year function problem, online to divide
such as the number of years $year=, such as 5
$staff _join= began on the day of 2008-05-02
I am now going to add years to the beginning of the year, such as 2008-05-02+5=2013-05-02 with what expression Ah,
To be able to run the code, thank you
Little brother This ($Begin = (Date ("Y", $staff _join) + $year) error, output 1970)
------Solution--------------------
PHP Code
------Solution--------------------
This assignment is wrong.
$staff _join = "20010-05-02";
Change to $staff_join = "2010-05-02";
------Solution--------------------
PHP Code
"; Echo $arrdate [0]; 2013?>
------Solution--------------------
$year = 5;
$staff _join= ' 2008-05-02 ';
$join _date = mktime (0, 0, 0,
substr ($staff _join, 5, 2), substr ($staff _join,-2, 2), substr ($staff _join, 0, 4));
echo Date (' y-m-d ', $join _date), "\ n";
$join _date_5_years_later =
Strtotime ("+ $year Year", $join _date);
echo Date (' y-m-d ', $join _date_5_years_later);
?>
------Solution--------------------
PHP code
!--? PHP $value = 5; $year = Date (' Y '); $year + = $value echo $year. Date ('-m-d ');
------Solution--------------------
$year = 5;
$staff _join = ' 2008-05-02 ';
$Begin = Date ("y-m-d", Strtotime ("+ $year Year $staff _join));
------Solution--------------------
to the upstairs boss.
!--? php
$year = 5;
$staff _join = ' 2008-05-02 ';
$Begin = Date ("y-m-d", Strtotime ("+ $year year $staff _join"));
Echo $Begin;
?
------Solution--------------------
!--? php
$year = 5;
$staff _join = ' 2008-05-02 ';
$Begin = Date ("y-m-d", Strtotime ("+ $year year, $staff _join"));
Echo $Begin;
?
------Solution--------------------
appears to have been resolved
------solution--------------------
Strtotime
----- -Solution--------------------
Man, look into the Strtotime function, which is described in detail in the manual.