How to Addding 1 Year with PHP

Ads
 

How to Addding 1 Year with PHP

Hi,

I am very fresh in PHP language. I trying to create a small application about how to adding 1 year in specific date. Please suggest me.

Thanks,

View Answers

February 10, 2011 at 10:27 AM

Hi,

In PHP provides method to add 1 year easily. The syntax given below will show how to add 1 year in php program. This may be help you to develop the application.

Example : ---

<?php

//Example to add 1 year to a date object

$currentDate = date("Y-m-d");// current date

//Display the current date
echo "Current Date: ".$currentDate."<br>";

//Add one year to current date
$dateOneYearAdded = strtotime(date("Y-m-d", strtotime($currentDate)) . " +1 year");
echo "Date After adding one year: ".date('l dS \o\f F Y', $dateOneYearAdded)."<br>";

?>

Ads









Related Tutorials/Questions & Answers:
How to Addding 1 Year with PHP
How to Addding 1 Year with PHP  Hi, I am very fresh in PHP language. I trying to create a small application about how to adding 1 year in specific date. Please suggest me. Thanks
How to Addding One Month with PHP ?
How to Addding One Month with PHP ?  Hi, I am very new in this php programming language. Can anybody will guide me how to add 1 month on a specific date on PHP. Please give any example or reference links. Please feel free
Advertisements
data science 1 year masters
data science 1 year masters  Hi, I am beginner in Data Science... science 1 year masters Try to provide me good examples or tutorials links so that I can learn the topic "data science 1 year masters". Also tell me which
1 year data science masters
1 year data science masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year data... can learn the topic "1 year data science masters". Also tell me which
1 year masters in data science
1 year masters in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... that I can learn the topic "1 year masters in data science". Also tell
data science 1 year course
data science 1 year course  Hi, I am beginner in Data Science... 1 year course Try to provide me good examples or tutorials links so that I can learn the topic "data science 1 year course". Also tell me which
1 year masters in artificial intelligence
1 year masters in artificial intelligence  Hi, I am beginner in Data...: 1 year masters in artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters
1 year masters data science
1 year masters data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... can learn the topic "1 year masters data science". Also tell me which
masters in data science 1 year
in data science 1 year Try to provide me good examples or tutorials links so that I can learn the topic "masters in data science 1 year". Also tell...masters in data science 1 year  Hi, I am beginner in Data Science
1 year masters programs in data science
1 year masters programs in data science  Hi, I am beginner in Data...: 1 year masters programs in data science Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters programs
How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year... of calculating days in a year? Thanks
how to put php in javascript
how to put php in javascript  How to write a javascript code inside php block
How to learn PHP
How to learn PHP  Hi, PHP seem easy language and beginners can find jobs in PHP easily. How to learn PHP? Thanks   Hi, You can learn PHP easily and we have 1000s of tutorials to teach you PHP. Check: PHP Tutorials
how to use calender in php
how to use calender in php  how to put calender in php
how to update image in php
how to update image in php  how to update image in php
How to Prepend Array in PHP
How to Prepend Array in PHP  hi, How can i prepand array in PHP. Please suggest any example of prepand array in PHP program. Thanks,   Hi, The PHP prepand array function in used before adding any elements
How to convert date to time in PHP?
How to convert date to time in PHP?  Hi, programmer. The PHP... and time. The PHP "time()" function is used to get the current Unix timestamp, a number representing the number of seconds since January 1, 1970 Greenwich Mean
How to Create Dynamic URLs in PHP?
How to Create Dynamic URLs in PHP?  How to Create Dynamic URLs in PHP
How to Find PHP version and configuration?
How to Find PHP version and configuration?  Find PHP version and configuration   If you want to find the version of PHP, you can just run the php command with php -v. Run PHP Command: $ php -v you can also check
How to use the PHP filetype() Function
How to use the PHP filetype() Function  Hi, What is the use of filetype() Function in php programming. Can anyone give any online example of the PHP filetype() Function. Thanks
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want to develop an small application store products. So, i how to create multiplication table 1 to 10. Please suggest online example related to creating multiplication
How to list even numbers between 1 and 100?
How to list even numbers between 1 and 100?  Hi, I Java to check if a number is even? How to list even numbers between 1 and 100? Thanks  ... the numbers between 1 and 100 for (int i=1;i <=num ; i++){ if(i%2==0
How to retrieve the ISO Date in PHP?
How to retrieve the ISO Date in PHP?  Hi, I am a beginner in PHP programming language. I have a query how to retrieve the ISO Date in PHP Language. Can any one suggest any reference for this. Thanks
How to Create Instance using PHP
How to Create Instance using PHP  Hi, How to create an instance class in PHP program. Can someone explain or suggest any online reference how to create an Instance class in PHP. Thanks
How to Declare Abstract Class in PHP ?
How to Declare Abstract Class in PHP ?  hi, I am a PHP Beginners. As i am trying to make an application where i trying to declare the abstract class of PHP. Please any one explain me how to declare abstract class in PHP program
how to divide 1 web page into some parts...
how to divide 1 web page into some parts...  how to divide 1 web page into some parts...i know it using frames in html,bt how can we do it in jsp... home page,bt m nt knowing how to divide that into frames in jsp.   <
how to divide 1 web page into some parts...
how to divide 1 web page into some parts...  how to divide 1 web page into some parts...i know it using frames in html,bt how can we do it in jsp... home page,bt m nt knowing how to divide that into frames in jsp.  <
how to display(update) current date and month in select box on selecting the year.
how to display(update) current date and month in select box on selecting the year.  how to display(update) current date and month in select box on selecting the year
How to Declare fflush() Function in PHP
How to Declare fflush() Function in PHP  Hi, Can someone give my any online example for write all the buffered data of an open file. Is it appropriate to use the PHP fflush() Function to develop this application? Please suggest
how to connect to database in php using mysql
how to connect to database in php using mysql  how to connect to database in php using mysql
how to post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form

Ads