Welcome Guest, Not a member yet? Register   Sign In
add dates
#1

[eluser]chinedubond[/eluser]
hello please i need some help in adding dates.
I have this date lets say 12/12/09 i want to make it 13/12/10.i.e add i year to it .
how do i do that in php?
#2

[eluser]featureBlend[/eluser]
Dude its not that difficult:

Code:
<?php
    $futuredate = strtotime("365 days");
    echo date("F d, Y", $futuredate);
?>

My suggestion to you before you post queries here would be to give it a teeney weeney bit of research....GL with translating the date to your preferred output format.
#3

[eluser]chinedubond[/eluser]
Thanks for ur elp but i got a solution

$expiryDate= date("d-m-Y",mktime(0, 0, 0, date("d",$date), date("m",$date), date("Y",$date)+1));
#4

[eluser]obiron2[/eluser]
29/02/2008??
#5

[eluser]xwero[/eluser]
[quote author="chinedubond" date="1228143866"]Thanks for ur elp but i got a solution

$expiryDate= date("d-m-Y",mktime(0, 0, 0, date("d",$date), date("m",$date), date("Y",$date)+1));[/quote]
If your date is a unix timestamp just do
Code:
// constants.php
define('YEAR_IN_SECONDS',31556926);
// somewhere in your code
$expiryDate= date("d-m-Y",$date+YEAR_IN_SECONDS);
unix timestamps are just numbers so date calculations should be calculations instead of function calls.




Theme © iAndrew 2016 - Forum software by © MyBB