Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP How to Addding 1 Year with PHP
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Vinod
How to Addding 1 Year with PHP
1 Answer(s)      3 years and 10 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,


Advertisement
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>";

?>


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 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 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.  <
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
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
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 put php in javascript
how to put php in javascript  How to write a javascript code inside php block
how to update image in php
how to update image in php  how to update image in php
how to use calender in php
how to use calender in php  how to put calender in php
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 divide 1 web page into some parts using div tag...
how to divide 1 web page into some parts using div tag...  how to divide 1 web page into some parts. i know it using frames in html,bt how can we do... creating home page,bt m nt knowing how to divide that into frames in jsp
wrong year
wrong year..   I think u are using other calendar Check Settings
Java get Year
Java get Year       In this section, you will learn how to obtain the current year. The Calendar.... The method cal.get(Calendar.YEAR) will return the current year. Here
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
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table in database. Understand with Example The Tutorial illustrate an example from 'Mysql Year
Mysql Date Add Year
'Mysql Date Add Year'. To graspe this example, we use Add('2008-12-15',INTERVAL 1 YEAR) query that add a 1 Year to the particular date.  SYNTAX:-ADDDATE...('2008-12-15',INTERVAL 1YEAR) add a 1 year interval to the particular date
How to Create Dynamic URLs in PHP?
How to Create Dynamic URLs in PHP?  How to Create Dynamic URLs in PHP
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 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 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
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
 

 

 

DMCA.com