How to Addding 1 Year with PHP

Ads

 
 

Share on Google+Share on Google+

Vinod
How to Addding 1 Year with PHP
1 Answer(s)      6 years and 9 months ago
Posted in : 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,

Ads
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
PHP Date add 1 year
to add 1 year easily. The code given below will show how you can add 1 year in php program. <?php //Example to add 1 year to a date object... Adding 1 year to a php date object is sometimes useful to solve some
PHP Date add 1 month
PHP Date add 1 month This example shows you how one month can be added... to add 1 month: <?php //PHP Example code to add one moth to a date... $dateOneMonthAdded = strtotime(date("Y-m-d", strtotime($todayDate)) . "+1
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
PHP Date add 1 hour
In the following example code we are showing how you can add one hour to a date object. <?php //This PHP Example code shows how to add one hour to a date object $todayDate = date("Y-m-d g:i a");// current
PHP Date add 1 day
PHP Date add 1 day This simple code will tell you how you can easily add 1 day to a date.  Example code for PHP Date add 1 day: <?php...("Y-m-d", strtotime($todayDate)) . " +1 day"); echo "
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
JSP:How to get year of system date - Date Calendar
JSP:How to get year of system date  Please tell me how to get year...=Calendar.getInstance(); int year=cal.get(Calendar.YEAR); System.out.println("Current Year: "+year ); } } For more Examples on Java visit to : http
how to put php in javascript
how to put php in javascript  How to write a javascript code inside php block
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
PHP Date add 1 week
The PHP Date add 1 week example code. In the the following example code we will show you how to add one week to any date object in the PHP program. <?php //Example to add 1 week to a date object $currentDate = date
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 learn PHP?
How to learn PHP?  Hi, How I can learn PHP easily? Thanks  Hi Friend, Please visit the following link: http://www.roseindia.net/php...://www.roseindia.net/php/ Thanks
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 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.  <
JDBC : Get year from Date
JDBC : Get year from Date In this section, you will learn how to get year from date. Get year from Date : In MySql you can get year from the given Date by using year() function.  YEAR(date) : This method returns the year
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 Create Dynamic URLs in PHP?
How to Create Dynamic URLs in PHP?  How to Create Dynamic URLs in PHP
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 destory session in PHP
How to destory session in PHP  Hi, I have to write a php page for logout. Please tell me what i should write? Thanks   Hi, You can use following code for logout: <? session_start(); session_destroy(); header
How to become a PHP Developer?
. To become a PHP developer following the following steps: How to become PHP Developer? a) PHP Basics Steps 1: Downloading and installing PHP environment... downloading and installing WAMP server at our PHP 5.0. Installation and at How
leap year
leap year  how to create class for leap year. It is leap year... isLeapYear(int year) { if (year < 0) { return false; } if (year % 4 == 0) { return true; } else if (year % 400 == 0) { return
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 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 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 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 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

Ads

 
Advertisement null

Ads