Author -  Sai gowtham

How to add 1 Year to Current Date in PHP

In this tutorial, we are going to learn about how to add 1 year to the Current Date in PHP with the help of examples.

Consider, we have following current date :

$currentDate = '2024-01-20'

After adding the 1 year to a current date it returns the output like this : “2025-01-20” .

Adding 1 year to a current date

To add 1 year to a current date in PHP, we can use the built-in date() function by passing the date format and unix timestamp of the future year.

The date() function takes the date format as a first argument and timestamp as an second argument then returns the formatted date string.

Here is an example:

$futureYear = date("Y-m-d", strtotime("+1 year"));

echo $futureYear;

Output:

2025-01-20

In the example above, we have passed the two arguments to a date() function. The first argument is date format "Y-m-d" and the second argument is strtotime(“+1 year”) this function returns the unix timestamp by adding 1 year to the current date.

Adding 5 years to the current date

Similarly, we can also add 5 years to the current date in PHP, by using the date() function with date format and future year timestamp that is +5 years in our case.

Here is an example:

$futureYear = date("Y-m-d", strtotime("+5 years"));

echo $futureYear;

Output:

2029-01-20

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY